In [1]:
from IPython.core.display import HTML
HTML("""
<style>
    h1{background-color:black; color:white; padding: 10px 10px 10px 10px}
    h2{background-color:blue; color:white;  padding: 5px 5px 5px 5px}
</style>
""")
Out[1]:
In [2]:
%matplotlib inline
In [3]:
!pip install pytextrank networkx 
Requirement already satisfied: pytextrank in /opt/conda/lib/python3.6/site-packages
Requirement already satisfied: networkx in /opt/conda/lib/python3.6/site-packages
Requirement already satisfied: spacy in /opt/conda/lib/python3.6/site-packages (from pytextrank)
Requirement already satisfied: statistics in /opt/conda/lib/python3.6/site-packages (from pytextrank)
Requirement already satisfied: graphviz in /opt/conda/lib/python3.6/site-packages (from pytextrank)
Requirement already satisfied: datasketch in /opt/conda/lib/python3.6/site-packages (from pytextrank)
Requirement already satisfied: decorator>=4.1.0 in /opt/conda/lib/python3.6/site-packages (from networkx)
Requirement already satisfied: thinc<6.6.0,>=6.5.0 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: preshed<2.0.0,>=1.0.0 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: cymem<1.32,>=1.30 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: dill<0.3,>=0.2 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: plac<1.0.0,>=0.9.6 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: murmurhash<0.27,>=0.26 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: numpy>=1.7 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: six in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: ujson>=1.35 in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: pathlib in /opt/conda/lib/python3.6/site-packages (from spacy->pytextrank)
Requirement already satisfied: docutils>=0.3 in /opt/conda/lib/python3.6/site-packages (from statistics->pytextrank)
Requirement already satisfied: redis>=2.10.0 in /opt/conda/lib/python3.6/site-packages (from datasketch->pytextrank)
Requirement already satisfied: termcolor in /opt/conda/lib/python3.6/site-packages (from thinc<6.6.0,>=6.5.0->spacy->pytextrank)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in /opt/conda/lib/python3.6/site-packages (from thinc<6.6.0,>=6.5.0->spacy->pytextrank)
Requirement already satisfied: wrapt in /opt/conda/lib/python3.6/site-packages (from thinc<6.6.0,>=6.5.0->spacy->pytextrank)
Requirement already satisfied: cytoolz<0.9,>=0.8 in /opt/conda/lib/python3.6/site-packages (from thinc<6.6.0,>=6.5.0->spacy->pytextrank)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /opt/conda/lib/python3.6/site-packages (from requests<3.0.0,>=2.13.0->spacy->pytextrank)
Requirement already satisfied: idna<2.7,>=2.5 in /opt/conda/lib/python3.6/site-packages (from requests<3.0.0,>=2.13.0->spacy->pytextrank)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /opt/conda/lib/python3.6/site-packages (from requests<3.0.0,>=2.13.0->spacy->pytextrank)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.6/site-packages (from requests<3.0.0,>=2.13.0->spacy->pytextrank)
Requirement already satisfied: toolz>=0.8.0 in /opt/conda/lib/python3.6/site-packages (from cytoolz<0.9,>=0.8->thinc<6.6.0,>=6.5.0->spacy->pytextrank)
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Load libraries

In [4]:
import pandas as pd
import numpy as np
import re
import string

import spacy
from spacy.en.word_sets import STOP_WORDS

import pytextrank

from collections import Counter

import pylab as plt

from gensim.models import Phrases
from gensim.models.word2vec import LineSentence
from gensim.corpora import Dictionary, MmCorpus
from gensim.models.ldamodel import LdaModel

import pyLDAvis
import pyLDAvis.gensim


from pprint import pprint
import warnings
In [5]:
import warnings
warnings.filterwarnings('ignore')
In [6]:
__file__ = pytextrank.__file__

Load data

In [7]:
mode = 'cjc' 

n_casetypes = 10
threshold = 50

#CJC
if mode.lower() == 'cjc':
    file_path = '../../data/original/cjc_cases_2017_sample_20180411_harmonized.csv'
    col_advice = 'LEGAL_ISSUES'
    col_synopsis = 'BACKGROUND_INFORMATION'
    col_casetype = 'CASE_TYPE_CJC'
#LSPBS
elif mode.lower() == 'lspbs':
    file_path = '../../data/original/lspbs_sample_2016_harmonized.csv'
    col_advice = 'ADVICE_SOUGHT'
    col_synopsis = 'CASE_SYNOPSIS'
    col_casetype = 'CASE_TYPE_LSPBS'
    

df = pd.read_csv(file_path).fillna('')

Load spacy model

In [8]:
spacy.util.set_data_path("../../data/spacy")
In [9]:
nlp = spacy.load('en_core_web_sm/en_core_web_sm-1.2.0')

Update stopwords

In [10]:
NEW_STOP_WORDS = STOP_WORDS.copy()
custom_stopwords = [
    'adverse','party','applicant',
    'legal','advice','general','guidance','advice','advise',
    'like','know','seeking'
]

to_keep = [
    'who','what','when','where','why','how','whether', 'will'
]
to_keep = ['will']
    
for s in custom_stopwords:
    NEW_STOP_WORDS.add(s)

for s in to_keep:
    NEW_STOP_WORDS.remove(s)

Modify Pytextrank functions

In [11]:
#!/usr/bin/env python
# encoding: utf-8

from collections import namedtuple
from datasketch import MinHash
from graphviz import Digraph
import hashlib
import json
import math
import networkx as nx
import os
import os.path
import re
import spacy
import statistics
import string

DEBUG = False # True

ParsedGraf = namedtuple('ParsedGraf', 'id, sha1, graf')
WordNode = namedtuple('WordNode', 'word_id, raw, root, pos, keep, idx')
RankedLexeme = namedtuple('RankedLexeme', 'text, rank, ids, pos, count')
SummarySent = namedtuple('SummarySent', 'dist, idx, text')


######################################################################
## filter the novel text versus quoted text in an email message

PAT_FORWARD = re.compile("\n\-+ Forwarded message \-+\n")
PAT_REPLIED = re.compile("\nOn.*\d+.*\n?wrote\:\n+\>")
PAT_UNSUBSC = re.compile("\n\-+\nTo unsubscribe,.*\nFor additional commands,.*")


def split_grafs (lines):
    """
    segment the raw text into paragraphs
    """
    graf = []

    for line in lines:
        line = line.strip()

        if len(line) < 1:
            if len(graf) > 0:
                yield "\n".join(graf)
                graf = []
        else:
            graf.append(line)

    if len(graf) > 0:
        yield "\n".join(graf)


def filter_quotes (text, is_email=True):
    """
    filter the quoted text out of a message
    """
    global DEBUG
    global PAT_FORWARD, PAT_REPLIED, PAT_UNSUBSC

    if is_email:
        text = filter(lambda x: x in string.printable, text)

        if DEBUG:
            print("text:", text)

        # strip off quoted text in a forward
        m = PAT_FORWARD.split(text, re.M)

        if m and len(m) > 1:
            text = m[0]

        # strip off quoted text in a reply
        m = PAT_REPLIED.split(text, re.M)

        if m and len(m) > 1:
            text = m[0]

        # strip off any trailing unsubscription notice
        m = PAT_UNSUBSC.split(text, re.M)

        if m:
            text = m[0]

    # replace any remaining quoted text with blank lines
    lines = []

    for line in text.split("\n"):
        if line.startswith(">"):
            lines.append("")
        else:
            lines.append(line)

    return list(split_grafs(lines))


######################################################################
## parse and markup text paragraphs for semantic analysis

PAT_PUNCT = re.compile(r'^\W+$')
PAT_SPACE = re.compile(r'\_+$')

POS_KEEPS = ['v', 'n', 'j']
POS_LEMMA = ['v', 'n']
UNIQ_WORDS = { ".": 0 }


def is_not_word (word):
    return PAT_PUNCT.match(word) or PAT_SPACE.match(word)


def get_word_id (root):
    """
    lookup/assign a unique identify for each word root
    """
    global UNIQ_WORDS

    # in practice, this should use a microservice via some robust
    # distributed cache, e.g., Redis, Cassandra, etc.
    if root not in UNIQ_WORDS:
        UNIQ_WORDS[root] = len(UNIQ_WORDS)

    return UNIQ_WORDS[root]


def fix_microsoft (foo):
    """
    fix special case for `c#`, `f#`, etc.; thanks Microsoft
    """
    i = 0
    bar = []

    while i < len(foo):
        text, lemma, pos, tag = foo[i]

        if (text == "#") and (i > 0):
            prev_tok = bar[-1]

            prev_tok[0] += "#"
            prev_tok[1] += "#"

            bar[-1] = prev_tok
        else:
            bar.append(foo[i])

        i += 1

    return bar


def fix_hypenation (foo):
    """
    fix hyphenation in the word list for a parsed sentence
    """
    i = 0
    bar = []

    while i < len(foo):
        text, lemma, pos, tag = foo[i]

        if (tag == "HYPH") and (i > 0) and (i < len(foo) - 1):
            prev_tok = bar[-1]
            next_tok = foo[i + 1]

            prev_tok[0] += "-" + next_tok[0]
            prev_tok[1] += "-" + next_tok[1]

            bar[-1] = prev_tok
            i += 2
        else:
            bar.append(foo[i])
            i += 1

    return bar


def parse_graf (doc_id, graf_text, base_idx, spacy_nlp=None):
    """
    CORE ALGORITHM: parse and markup sentences in the given paragraph
    """
    global DEBUG
    global POS_KEEPS, POS_LEMMA, SPACY_NLP

    # set up the spaCy NLP parser
    if not spacy_nlp:
        if not SPACY_NLP:
            SPACY_NLP = spacy.load("en_core_web_sm/en_core_web_sm-1.2.0")

        spacy_nlp = SPACY_NLP

    markup = []
    new_base_idx = base_idx
    doc = spacy_nlp(graf_text, parse=True)

    for span in doc.sents:
        graf = []
        digest = hashlib.sha1()

        if DEBUG:
            print(span)

        # build a word list, on which to apply corrections
        word_list = []

        for tag_idx in range(span.start, span.end):
            token = doc[tag_idx]

            if DEBUG:
                print("IDX", tag_idx, token.text, token.tag_, token.pos_)
                print("reg", is_not_word(token.text))

            word_list.append([token.text, token.lemma_, token.pos_, token.tag_])

        # scan the parsed sentence, annotating as a list of `WordNode`
        corrected_words = fix_microsoft(fix_hypenation(word_list))

        for tok_text, tok_lemma, tok_pos, tok_tag in corrected_words:
            word = WordNode(word_id=0, raw=tok_text, root=tok_text.lower(), pos=tok_tag, keep=0, idx=new_base_idx)

            if is_not_word(tok_text) or (tok_tag == "SYM"):
                # a punctuation, or other symbol
                pos_family = '.'
                word = word._replace(pos=pos_family)
            else:
                pos_family = tok_tag.lower()[0]

            if pos_family in POS_LEMMA:
                # can lemmatize this word?
                word = word._replace(root=tok_lemma)

            if pos_family in POS_KEEPS:
                word = word._replace(word_id=get_word_id(word.root), keep=1)

            digest.update(word.root.encode('utf-8'))

            # schema: word_id, raw, root, pos, keep, idx
            if DEBUG:
                print(word)

            graf.append(list(word))
            new_base_idx += 1

        markup.append(ParsedGraf(id=doc_id, sha1=digest.hexdigest(), graf=graf))

    return markup, new_base_idx


def parse_doc (json_iter):
    """
    parse one document to prep for TextRank
    """
    global DEBUG

    for meta in json_iter:
        base_idx = 0

        for graf_text in filter_quotes(meta["text"], is_email=False):
            if DEBUG:
                print("graf_text:", graf_text)

            grafs, new_base_idx = parse_graf(meta["id"], graf_text, base_idx)
            base_idx = new_base_idx

            for graf in grafs:
                yield graf


######################################################################
## graph analytics

def get_tiles (graf, size=3):
    """
    generate word pairs for the TextRank graph
    """
    keeps = list(filter(lambda w: w.word_id > 0, graf))
    keeps_len = len(keeps)

    for i in iter(range(0, keeps_len - 1)):
        w0 = keeps[i]

        for j in iter(range(i + 1, min(keeps_len, i + 1 + size))):
            w1 = keeps[j]

            if (w1.idx - w0.idx) <= size:
                yield (w0.root, w1.root,)


def build_graph (json_iter):
    """
    construct the TextRank graph from parsed paragraphs
    """
    global DEBUG, WordNode
    graph = nx.DiGraph()

    for meta in json_iter:
        if DEBUG:
            print(meta["graf"])

        for pair in get_tiles(map(WordNode._make, meta["graf"])):
            if DEBUG:
                print(pair)

            for word_id in pair:
                if not graph.has_node(word_id):
                    graph.add_node(word_id)

            try:
                graph.adj[pair[0]][pair[1]]["weight"] += 1.0
            except KeyError:
                graph.add_edge(pair[0], pair[1], weight=1.0)

    return graph


def write_dot (graph, ranks, path="graph.dot"):
    """
    output the graph in Dot file format
    """
    dot = Digraph()

    for node in graph.nodes():
        dot.node(node, "%s %0.3f" % (node, ranks[node]))

    for edge in graph.edges():
        dot.edge(edge[0], edge[1], constraint="false")

    with open(path, 'w') as f:
        f.write(dot.source)


def render_ranks (graph, ranks, dot_file="graph.dot"):
    """
    render the TextRank graph for visual formats
    """
    if dot_file:
        write_dot(graph, ranks, path=dot_file)

    ## omitted since matplotlib isn't reliable enough
    #import matplotlib.pyplot as plt
    #nx.draw_networkx(graph)
    #plt.savefig(img_file)
    #plt.show()


def text_rank (path):
    """
    run the TextRank algorithm
    """
    graph = build_graph(json_iter(path))
    ranks = nx.pagerank(graph)

    return graph, ranks


######################################################################
## collect key phrases

SPACY_NLP = None
STOPWORDS = NEW_STOP_WORDS

STOPWORDS
def load_stopwords (stop_file):
    stopwords = set([])

    # provide a default if needed
    if not stop_file:
        stop_file = "stop.txt"

    # check whether the path is fully qualified
    if os.path.isfile(stop_file):
        stop_path = stop_file

    # check for the file in the current working directory
    else:
        cwd = os.getcwd()
        stop_path = os.path.join(cwd, stop_file)

        # check for the file in the same directory as this code module
        if not os.path.isfile(stop_path):
            loc = os.path.realpath( os.path.join(cwd, os.path.dirname(__file__)) )
            stop_path = os.path.join(loc, stop_file)

    try:
        with open(stop_path, "r") as f:
            for line in f.readlines():
                stopwords.add(line.strip().lower())
    except FileNotFoundError:
        pass

    return stopwords


def find_chunk_sub (phrase, np, i):
    for j in iter(range(0, len(np))):
        p = phrase[i + j]

        if p.text != np[j]:
            return None

    return phrase[i:i + len(np)]


def find_chunk (phrase, np):
    """
    leverage noun phrase chunking
    """
    for i in iter(range(0, len(phrase))):
        parsed_np = find_chunk_sub(phrase, np, i)

        if parsed_np:
            return parsed_np


def enumerate_chunks (phrase, spacy_nlp):
    """
    iterate through the noun phrases
    """
    if (len(phrase) > 1):
        found = False
        text = " ".join([rl.text for rl in phrase])
        doc = spacy_nlp(text.strip(), parse=True)

        for np in doc.noun_chunks:
            if np.text != text:
                found = True
                yield np.text, find_chunk(phrase, np.text.split(" "))

        if not found and all([rl.pos[0] != "v" for rl in phrase]):
            yield text, phrase


def collect_keyword (sent, ranks, stopwords):
    """
    iterator for collecting the single-word keyphrases
    """
    for w in sent:
        if (w.word_id > 0) and (w.root in ranks) and (w.pos[0] in "NV") and (w.root not in stopwords):
            rl = RankedLexeme(text=w.raw.lower(), rank=ranks[w.root]/2.0, ids=[w.word_id], pos=w.pos.lower(), count=1)

            if DEBUG:
                print(rl)

            yield rl


def find_entity (sent, ranks, ent, i):
    if i >= len(sent):
        return None, None
    else:
        for j in iter(range(0, len(ent))):
            w = sent[i + j]

            if w.raw != ent[j]:
                return find_entity(sent, ranks, ent, i + 1)

        w_ranks = []
        w_ids = []

        for w in sent[i:i + len(ent)]:
            w_ids.append(w.word_id)

            if w.root in ranks:
                w_ranks.append(ranks[w.root])
            else:
                w_ranks.append(0.0)

        return w_ranks, w_ids


def collect_entities (sent, ranks, stopwords, spacy_nlp):
    """
    iterator for collecting the named-entities
    """
    global DEBUG
    sent_text = " ".join([w.raw for w in sent])

    if DEBUG:
        print("sent:", sent_text)

    for ent in spacy_nlp(sent_text).ents:
        if DEBUG:
            print("NER:", ent.label_, ent.text)

        if (ent.label_ not in ["CARDINAL"]) and (ent.text.lower() not in stopwords):
            w_ranks, w_ids = find_entity(sent, ranks, ent.text.split(" "), 0)

            if w_ranks and w_ids:
                rl = RankedLexeme(text=ent.text.lower(), rank=w_ranks, ids=w_ids, pos="np", count=1)

                if DEBUG:
                    print(rl)

                yield rl


def collect_phrases (sent, ranks, spacy_nlp):
    """
    iterator for collecting the noun phrases
    """
    tail = 0
    last_idx = sent[0].idx - 1
    phrase = []

    while tail < len(sent):
        w = sent[tail]

        if (w.word_id > 0) and (w.root in ranks) and ((w.idx - last_idx) == 1):
            # keep collecting...
            rl = RankedLexeme(text=w.raw.lower(), rank=ranks[w.root], ids=w.word_id, pos=w.pos.lower(), count=1)
            phrase.append(rl)
        else:
            # just hit a phrase boundary
            for text, p in enumerate_chunks(phrase, spacy_nlp):
                if p:
                    id_list = [rl.ids for rl in p]
                    rank_list = [rl.rank for rl in p]
                    np_rl = RankedLexeme(text=text, rank=rank_list, ids=id_list, pos="np", count=1)

                    if DEBUG:
                        print(np_rl)

                    yield np_rl

            phrase = []

        last_idx = w.idx
        tail += 1


def calc_rms (values):
    """
    calculate a root-mean-squared metric for a list of float values
    """
    #return math.sqrt(sum([x**2.0 for x in values])) / float(len(values))
    # take the max() which works fine
    return max(values)


def normalize_key_phrases (path, ranks, stopwords=None, spacy_nlp=None, skip_ner=True):
    """
    collect keyphrases, named entities, etc., while removing stop words
    """
    global STOPWORDS, SPACY_NLP

    # set up the stop words
    if (type(stopwords) is list) or (type(stopwords) is set):
        # explicit conversion to a set, for better performance
        stopwords = set(stopwords)
    else:
        if not STOPWORDS:
            STOPWORDS = load_stopwords(stopwords)

        stopwords = STOPWORDS

    # set up the spaCy NLP parser
    if not spacy_nlp:
        if not SPACY_NLP:
            SPACY_NLP = spacy.load("en_core_web_sm/en_core_web_sm-1.2.0")

        spacy_nlp = SPACY_NLP

    # collect keyphrases
    single_lex = {}
    phrase_lex = {}

    if isinstance(path, str):
        path = json_iter(path)

    for meta in path:
        sent = [w for w in map(WordNode._make, meta["graf"])]

        for rl in collect_keyword(sent, ranks, stopwords):
            id = str(rl.ids)

            if id not in single_lex:
                single_lex[id] = rl
            else:
                prev_lex = single_lex[id]
                single_lex[id] = rl._replace(count = prev_lex.count + 1)

        if not skip_ner:
            for rl in collect_entities(sent, ranks, stopwords, spacy_nlp):
                id = str(rl.ids)

                if id not in phrase_lex:
                    phrase_lex[id] = rl
                else:
                    prev_lex = phrase_lex[id]
                    phrase_lex[id] = rl._replace(count = prev_lex.count + 1)

        for rl in collect_phrases(sent, ranks, spacy_nlp):
            id = str(rl.ids)

            if id not in phrase_lex:
                phrase_lex[id] = rl
            else:
                prev_lex = phrase_lex[id]
                phrase_lex[id] = rl._replace(count = prev_lex.count + 1)

    # normalize ranks across single keywords and longer phrases:
    #    * boost the noun phrases based on their length
    #    * penalize the noun phrases for repeated words
    rank_list = [rl.rank for rl in single_lex.values()]

    if len(rank_list) < 1:
        max_single_rank = 0
    else:
        max_single_rank = max(rank_list)

    repeated_roots = {}

    for rl in sorted(phrase_lex.values(), key=lambda rl: len(rl), reverse=True):
        rank_list = []

        for i in iter(range(0, len(rl.ids))):
            id = rl.ids[i]

            if not id in repeated_roots:
                repeated_roots[id] = 1.0
                rank_list.append(rl.rank[i])
            else:
                repeated_roots[id] += 1.0
                rank_list.append(rl.rank[i] / repeated_roots[id])

        phrase_rank = calc_rms(rank_list)
        single_lex[str(rl.ids)] = rl._replace(rank = phrase_rank)

    # scale all the ranks together, so they sum to 1.0
    sum_ranks = sum([rl.rank for rl in single_lex.values()])

    for rl in sorted(single_lex.values(), key=lambda rl: rl.rank, reverse=True):
        if sum_ranks > 0.0:
            rl = rl._replace(rank=rl.rank / sum_ranks)
        elif rl.rank == 0.0:
            rl = rl._replace(rank=0.1)

        rl = rl._replace(text=re.sub(r"\s([\.\,\-\+\:\@])\s", r"\1", rl.text))
        yield rl


######################################################################
## sentence significance

def mh_digest (data):
    """
    create a MinHash digest
    """
    num_perm = 512
    m = MinHash(num_perm)

    for d in data:
        m.update(d.encode('utf8'))

    return m


def rank_kernel (path):
    """
    return a list (matrix-ish) of the key phrases and their ranks
    """
    kernel = []

    if isinstance(path, str):
        path = json_iter(path)

    for meta in path:
        if not isinstance(meta, RankedLexeme):
            rl = RankedLexeme(**meta)
        else:
            rl = meta

        m = mh_digest(map(lambda x: str(x), rl.ids))
        kernel.append((rl, m,))

    return kernel


def top_sentences (kernel, path):
    """
    determine distance for each sentence
    """
    key_sent = {}
    i = 0

    if isinstance(path, str):
        path = json_iter(path)

    for meta in path:
        graf = meta["graf"]
        tagged_sent = [WordNode._make(x) for x in graf]
        text = " ".join([w.raw for w in tagged_sent])

        m_sent = mh_digest([str(w.word_id) for w in tagged_sent])
        dist = sum([m_sent.jaccard(m) * rl.rank for rl, m in kernel])
        key_sent[text] = (dist, i)
        i += 1

    for text, (dist, i) in sorted(key_sent.items(), key=lambda x: x[1][0], reverse=True):
        yield SummarySent(dist=dist, idx=i, text=text)


######################################################################
## document summarization

def limit_keyphrases (path, phrase_limit=20):
    """
    iterator for the most significant key phrases
    """
    rank_thresh = None

    if isinstance(path, str):
        lex = []

        for meta in json_iter(path):
            rl = RankedLexeme(**meta)
            lex.append(rl)
    else:
        lex = path

    if len(lex) > 0:
        rank_thresh = statistics.mean([rl.rank for rl in lex])
    else:
            rank_thresh = 0

    used = 0

    for rl in lex:
        if rl.pos[0] != "v":
            if (used > phrase_limit) or (rl.rank < rank_thresh):
                return

            used += 1
            yield rl.text.replace(" - ", "-")


def limit_sentences (path, word_limit=100):
    """
    iterator for the most significant sentences, up to a specified limit
    """
    word_count = 0

    if isinstance(path, str):
        path = json_iter(path)

    for meta in path:
        if not isinstance(meta, SummarySent):
            p = SummarySent(**meta)
        else:
            p = meta

        sent_text = p.text.strip().split(" ")
        sent_len = len(sent_text)

        if (word_count + sent_len) > word_limit:
            break
        else:
            word_count += sent_len
            yield sent_text, p.idx, p.dist


def make_sentence (sent_text):
    """
    construct a sentence text, with proper spacing
    """
    lex = []
    idx = 0

    for word in sent_text:
        if len(word) > 0:
            if (idx > 0) and not (word[0] in ",.:;!?-\"'"):
                lex.append(" ")

            lex.append(word)

        idx += 1

    return "".join(lex)


######################################################################
## common utilities

def json_iter (path):
    """
    iterator for JSON-per-line in a file pattern
    """
    with open(path, 'r') as f:
        for line in f.readlines():
            yield json.loads(line)


def pretty_print (obj, indent=False):
    """
    pretty print a JSON object
    """

    if indent:
        return json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': '))
    else:
        return json.dumps(obj, sort_keys=True)

Function to extract summary

In [12]:
def textrank_generate(df, 
                      case_type, 
                      col='advice',
                      sim_score_threshold=0.9, 
                      phrase_limit=30, 
                      word_limit=1000, 
                      to_print=False, 
                      to_plot=True):
    
    if col.lower()=='both':
        print('\nColumns used: advice and synopsis')
        advice = (df
                  .loc[df[col_casetype] == case_type, col_advice]
                  .append(df
                          .loc[df[col_casetype] == case_type, col_synopsis], 
                          ignore_index=True)
                  .values)
    elif col.lower()=='synopsis':
        print('\nColumn used: synopsis')
        advice = df.loc[df[col_casetype] == case_type, col_synopsis].values
    else:
        print('\nColumn used: advice')
        advice = df.loc[df[col_casetype] == case_type, col_advice].values
    
    charset = set(list(''.join(advice)))
    
    advice = [adv.replace('A/P',' Adverse Party ') for adv in advice] # standardize some short hand notation
    advice = [adv.replace('#',' #') for adv in advice]
    advice_all = ' '.join(advice).replace('"', '\'')
    advice_json = '{"id":"1", "text":"' + advice_all + '"}'
    
    path_stage0 = 'advice.json'
    path_stage1 = 'ol.json'
    path_stage2 = "o2.json"
    path_stage3 = "o3.json"
    
    with open(path_stage0, 'w') as f:
        f.write(advice_json)
    
    with open(path_stage1, 'w') as f:
        for graf in parse_doc(json_iter(path_stage0)):
            f.write("%s\n" % pretty_print(graf._asdict()))
            
            if to_print:
                # to view output in this notebook
                print(pretty_print(graf))
    
    graph, ranks = text_rank(path_stage1)
    render_ranks(graph, ranks)
    
    with open(path_stage2, 'w') as f:
        for rl in normalize_key_phrases(path_stage1, ranks):
            f.write("%s\n" % pretty_print(rl._asdict()))
            
            if to_print:
                # to view output in this notebook
                print(pretty_print(rl))
    
    if to_plot:
        plt.figure(1, figsize = (12, 12))
        nx.draw(graph, with_labels=True) 
        plt.show()
    
    
    kernel = rank_kernel(path_stage2)

    with open(path_stage3, 'w') as f:
        for s in top_sentences(kernel, path_stage1):
            f.write(pretty_print(s._asdict()))
            f.write("\n")
            
            if to_print:
                # to view output in this notebook
                print(pretty_print(s._asdict()))
    
    phrases = ", ".join(set([p for p in limit_keyphrases(path_stage2, phrase_limit=phrase_limit)]))
    sent_iter = sorted(limit_sentences(path_stage3, word_limit=word_limit), key=lambda x: x[2], reverse=True)
    s = []
    
    sent_text_list = []
    counter = 1
    for sent_text, idx, dist in sent_iter:
        if len(sent_text_list) == 0:
            sim_score_prev = 0.
            sent_text_list.append(nlp(make_sentence(sent_text)))
            s.append('sentence_' + 
                     str(counter) + 
                     ': (dist :' + 
                     str(round(dist, 5)) + 
                     ')\n\t - ' + 
                     make_sentence(sent_text))
            counter += 1
        else:
            sim_text_curr = nlp(make_sentence(sent_text))
            max_sim_score = max([sent_text_prev.similarity(sim_text_curr) for sent_text_prev in sent_text_list])
            if max_sim_score < sim_score_threshold:
                sent_text_list.append(sim_text_curr)
                s.append('sentence_' + 
                         str(counter) + 
                         ': (dist :' + 
                        str(round(dist, 5)) + 
                         ')\n\t - ' + 
                         make_sentence(sent_text))
                counter += 1

    graf_text = "\n".join(s)
    
    print("**excerpts:**\n%s\n\n**keywords:**\n%s" % (graf_text, phrases,))

Extract top case types

In [13]:
top_n_casestypes = (df
                    .loc[:, [col_casetype, col_advice]]
                    .groupby(col_casetype, as_index=False)
                    .agg('count')
                    .sort_values(col_advice, ascending=False)
                    .iloc[:n_casetypes, :]
                   )

top_n_casestypes = (top_n_casestypes
                    .loc[top_n_casestypes[col_advice] >= threshold, :]
                   ).values
In [14]:
print(top_n_casestypes)
[['General Divorce Proceedings' 391]
 ['Bankruptcy / DRS' 290]
 ['Maintenance' 168]
 ['Custody / Child Access' 142]
 ["Magistrate's Complaints & Private Summons" 104]
 ['Traffic Violations' 103]
 ['Departmental/Statutory Board Charges & Summonses' 78]
 ['Others' 61]
 ['Tenancy Disputes' 53]]

Generate Summaries

Advice only

In [15]:
for casetype, num_cases in top_n_casestypes:
    print('\n\n\nCasetype: ' + 
          casetype + 
          ' (' + 
          str(num_cases) + 
          ' cases)')
    textrank_generate(df, casetype, col='advice')


Casetype: General Divorce Proceedings (391 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.08594)
	 - Proceedings for divorce?
sentence_2: (dist :0.08184)
	 - How long is the divorce proceedings?
sentence_3: (dist :0.0716)
	 - General divorce proceedings.
sentence_4: (dist :0.07098)
	 - Whether there are any procedures for a divorce proceeding?
sentence_5: (dist :0.06643)
	 - Divorce proceedings and documents.
sentence_6: (dist :0.05974)
	 - How to file for a divorce?
sentence_7: (dist :0.05834)
	 - RE DIVORCE.
sentence_8: (dist :0.05739)
	 - The process of a divorce; 2.
sentence_9: (dist :0.05584)
	 - Difference between divorce proceedings and separation.
sentence_10: (dist :0.05463)
	 - How to get divorced?
sentence_11: (dist :0.05414)
	 - 1 ) Can the divorce proceed?
sentence_12: (dist :0.05266)
	 - The applicant would like to how she may divorce her husband.
sentence_13: (dist :0.0524)
	 - Seeking for divorce.
sentence_14: (dist :0.05093)
	 - Should Applicant return to China, how will that affect divorce proceedings?
sentence_15: (dist :0.04844)
	 - Husband refuses to divorce.
sentence_16: (dist :0.04548)
	 - Whether client can extend her visa pass for divorce proceedings?
sentence_17: (dist :0.04425)
	 - Divorce- further arguments.

**keywords:**
husband, divorce suit, applicant approach, divorce procedure, current husband, divorce proceeds, proceedings, lawyer fees, child custody, is client, custody, divorce proceedings, general divorce proceedings, divorce proposal, matrimonial flat, applicant file, normal divorce proceeding, divorce case, normal divorce case, uncontested divorce, applicant, child maintenance, family/divorce divorce, wife, divorce, is applicant, local husband, singapore law, lower child maintenance, legal procedures, malaysia property



Casetype: Bankruptcy / DRS (290 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.05083)
	 - Should the applicant file for bankruptcy himself?
sentence_2: (dist :0.04883)
	 - How to file a bankruptcy application?
sentence_3: (dist :0.04506)
	 - How to fill in the application for bankruptcy form?
sentence_4: (dist :0.04039)
	 - The applicant would like a bankruptcy protection.
sentence_5: (dist :0.04022)
	 - Bankruptcy proceedings; process of DRS.
sentence_6: (dist :0.03971)
	 - Applicant would like to self declare bankruptcy.
sentence_7: (dist :0.03926)
	 - ( 5 ) When can Applicant be discharged from bankruptcy?
sentence_8: (dist :0.03841)
	 - What is self-declared bankruptcy?
sentence_9: (dist :0.03831)
	 - The applicant now wishes to apply for bankruptcy.
sentence_10: (dist :0.03735)
	 - How to avoid bankruptcy from the bank?
sentence_11: (dist :0.03585)
	 - Restrictions after declaring bankruptcy.
sentence_12: (dist :0.0355)
	 - Will his employer know of his bankruptcy?
sentence_13: (dist :0.03466)
	 - What is the procedure for bankruptcy proceedings?
sentence_14: (dist :0.03404)
	 - How to go about the bankruptcy process.
sentence_15: (dist :0.03386)
	 - Can the bankruptcy proceedings supercede the appeal?
sentence_16: (dist :0.03283)
	 - The applicant came in for legal advice on his bankruptcy proposal and debt proceedings.
sentence_17: (dist :0.02844)
	 - What is the estimated period of his bankruptcy?
sentence_18: (dist :0.02817)
	 - If applicant files for bankruptcy, will be be able to repay the debt on a monthly instalment of $ 100-$ 120? 2.
sentence_19: (dist :0.02814)
	 - Procedure for self-declaration of bankruptcy, and whether party has filed the application correctly.
sentence_20: (dist :0.028)
	 - Is bankruptcy the end of the world.
sentence_21: (dist :0.02709)
	 - Will the OA notify the creditors of her bankruptcy or her being under a DRS?
sentence_22: (dist :0.02652)
	 - Whether his banking loans will be affected by the bankruptcy claim.
sentence_23: (dist :0.02583)
	 - Divorce matters Can he challenge the bankruptcy order?
sentence_24: (dist :0.02543)
	 - Applicant also sought a deeper insight into life post- bankruptcy.
sentence_25: (dist :0.02496)
	 - Do not know position of bankruptcy side.
sentence_26: (dist :0.02476)
	 - repercussions of non-disclosure 1 ) Financial Oligations/ Restrictions after bankruptcy.
sentence_27: (dist :0.02444)
	 - What is the minimum sum needed to declare bankruptcy?
sentence_28: (dist :0.02365)
	 - Will filing for a bankruptcy order stop the creditors from pursuing further action?

**keywords:**
bankrupt person, declare, bankruptcy application applicant, bankruptcy proceedings, application, court order, bankruptcy application form, drs application procedure, bank, hdb loan, self-declared bankruptcy process applicant, court issue, application form, other outstanding debts, bankrupt due, bankruptcy application, mothers property, applicant, bankruptcy claim, applicant files, bankruptcy judgment, self declared bankruptcy applicant, creditors, banrkruptcy cases, bankrupt, bankruptcy suit, banking loans, pay, impending bankrupt person, other banks, bankruptcy actions



Casetype: Maintenance (168 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.05543)
	 - Can she claim maintenance for the child?
sentence_2: (dist :0.05076)
	 - Variation of the maintenance order is possible.
sentence_3: (dist :0.04731)
	 - How can I enforce the court order or the current maintenance order?
sentence_4: (dist :0.04382)
	 - What are the grounds of increasing maintenance of children?
sentence_5: (dist :0.04288)
	 - The maintenance amount only for ex-wife.
sentence_6: (dist :0.03552)
	 - How to get the maintenance money?
sentence_7: (dist :0.03545)
	 - What is variation order?
sentence_8: (dist :0.03444)
	 - Order of court was given 2008/2009.
sentence_9: (dist :0.03256)
	 - Applicant wants maintenance from her husband, but husband is in Greece.
sentence_10: (dist :0.03063)
	 - How the applicant can reduce the amount of maintenance from $ 800 ( including $ 200 arrears ) to-400-$500.
sentence_11: (dist :0.03001)
	 - Was It necessary for him to provide maintenance on a monthly basis. 1.
sentence_12: (dist :0.02907)
	 - What is the legal recourse for the client?

**keywords:**
husband, maintenance fees, previous marriage, certificate, children, upcoming court session, is client, money, court order, lawyer, matrimonial assets, marriage certificate, birth certificate, maintenance court order, maintenance order, divorce order, child maintenance, child maintenance sum, lower amount, custody order, original amount, monthly maintenance, court session, maintenance amount, wife, arrears proceedings, order, maintenance, address applicant, applicants, child variation



Casetype: Custody / Child Access (142 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.05142)
	 - Applicant wants custody of the children.
sentence_2: (dist :0.04559)
	 - Applicant would like care and control over the child.
sentence_3: (dist :0.04185)
	 - How should Applicant gain access to the child?
sentence_4: (dist :0.0374)
	 - Procedure for applying for custody of his children.
sentence_5: (dist :0.03565)
	 - Court order for wife to pay applicant maintenance but she failed to.
sentence_6: (dist :0.03052)
	 - Is the court order negotiatable?
sentence_7: (dist :0.02786)
	 - How can I get back my children?
sentence_8: (dist :0.02658)
	 - How do custody matters work?
sentence_9: (dist :0.02476)
	 - 4.Sought advice on divorcing current husband and gaining maintenance for two children.
sentence_10: (dist :0.02334)
	 - Whether Applicant can enforce the orders made during the divorce.
sentence_11: (dist :0.02326)
	 - Applicant wants to bring his child to VSS during his rightful time.

**keywords:**
maintenance fees, court order negotiatable, custody matters, current husband, access, children, child care, future administrative work, reasonable access, custody, divorce proceedings, court order, control, applicant gain, malaysian court, applicant dispute, family court, son, applicant, children custody, applicant maintenance, wife, daughter, reply affidavit, ex-husband complies, court, court-ordered access timings, care, interim custody, possible variation order, ex husband



Casetype: Magistrate's Complaints & Private Summons (104 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.02732)
	 - Should the applicant lodge another police report?
sentence_2: (dist :0.02692)
	 - How can the applicant bring the other party to the court?
sentence_3: (dist :0.0236)
	 - Should the applicant file a magistrate's complaint?
sentence_4: (dist :0.02055)
	 - What are the legal actions available.
sentence_5: (dist :0.01801)
	 - The applicant was recourse against this third party to claim for damages for his injury.
sentence_6: (dist :0.01733)
	 - - Applicant fears that gang members will retaliate should he commence with legal proceedings.
sentence_7: (dist :0.01589)
	 - Can the applicant claim compensation for injuries etc. via ways other than suing?
sentence_8: (dist :0.01428)
	 - Applicant wants to take further action for being verbally abusive.
sentence_9: (dist :0.01419)
	 - How can the applicant sue his neighbor.
sentence_10: (dist :0.01314)
	 - 1 ) What legal options could they continue on to pursue this assault situation?
sentence_11: (dist :0.01256)
	 - Applicant enquired as to how he could represent himself in litigation.
sentence_12: (dist :0.01238)
	 - - Applicant wishes for mediation between him and the AP to settle the noise pollution.
sentence_13: (dist :0.01194)
	 - Can I make a magistrates complaint?
sentence_14: (dist :0.01191)
	 - Whether client can qualify for legal aid?
sentence_15: (dist :0.01175)
	 - What is the recommended course of action?
sentence_16: (dist :0.01148)
	 - What are the remedies for the applicant's son for his alleged assault?
sentence_17: (dist :0.01117)
	 - The applicant stated in court that the calls are not threatening, abusive or insulting which meant that the claim can not be classified as harassment.
sentence_18: (dist :0.01)
	 - Whether children under 21 can testify in court?
sentence_19: (dist :0.00956)
	 - -Have other people done their own proceedings?
sentence_20: (dist :0.00926)
	 - The applicant asked if a PPO is applicable in this case.
sentence_21: (dist :0.00894)
	 - Are the actions done by the harasser considered a criminal act ( criminal intimidation )?

**keywords:**
action, other party, individual, person x, such matters, legal cost, applicant prepare, applicant lodge, alleged assault, first police report, damages, court issue, personal claim, charges, own proceedings, police officer, applicant file, magistrates court, protection order, magistrate, applicant, applicant claim compensation, claim, magistrate complaint, third party, next course, police, court, legal actions, other people, satisfactory legal action



Casetype: Traffic Violations (103 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.0303)
	 - How will the charge possibly be like?
sentence_2: (dist :0.02004)
	 - How to request for a lighter sentence?
sentence_3: (dist :0.01747)
	 - What are the maximum penalties for the charges faced?
sentence_4: (dist :0.01543)
	 - 1 ) The client wants to understand the consequences of pleading guilty for the charge.
sentence_5: (dist :0.01319)
	 - Can I submit my mitigation letter on the court date itself?
sentence_6: (dist :0.00904)
	 - Should the client get legal representation?
sentence_7: (dist :0.00723)
	 - Applicant is seeking clarifications for next steps.
sentence_8: (dist :0.00694)
	 - - What should applicant do for this case?-
sentence_9: (dist :0.00689)
	 - Criminal-Motor Accident Is the sentencing fair?
sentence_10: (dist :0.00678)
	 - Is it dangerous driving?
sentence_11: (dist :0.00607)
	 - Whether client is obliged to plead guilty?
sentence_12: (dist :0.00602)
	 - Should she plead guilty?
sentence_13: (dist :0.00579)
	 - Applicant is seeking clarification on the summons he received and how he can prove his innocence.
sentence_14: (dist :0.00577)
	 - Applicant was driving past a traffic light ( which he claimed was yellow ) when a motorbike bumped into his car.
sentence_15: (dist :0.00563)
	 - Can the meeting be delayed until his medical issues are resolved?
sentence_16: (dist :0.00562)
	 - Whether any tortious claims may arise in regards to the accident?
sentence_17: (dist :0.00521)
	 - Applicant has no financial resources to compensate.
sentence_18: (dist :0.00477)
	 - Should he engage a lawyer?
sentence_19: (dist :0.00448)
	 - Who do I write a letter of leniency to?

**keywords:**
many days imprisonment, medical issues, heavier sentence, mitigation letter, innocence, legal representation, traffic light, imprisonment, jail term, months, amount, fines, test, next steps, charge, applicant, sentences, lighter sentence, court date, court session, living, current lawyers, charge slip, lighter charge, mitigation/charge reduction, disqualification, immediate effect, dangerous driving, criminal-motor accident, effect, client



Casetype: Departmental/Statutory Board Charges & Summonses (78 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.02159)
	 - Whether court fines can be paid in installments?
sentence_2: (dist :0.02119)
	 - How should the applicant respond to the criminal charges?
sentence_3: (dist :0.01876)
	 - Mode of payment for the potential fine.
sentence_4: (dist :0.01732)
	 - Should Applicant accept this and pay for the fine?
sentence_5: (dist :0.01483)
	 - What are his options as he conceded he worked for other employers knowingly as his employer under work permit told him to find his own work.
sentence_6: (dist :0.0143)
	 - What happens on the court hearing on the 15th of November 2017?
sentence_7: (dist :0.01355)
	 - Criminal charge-s 509.
sentence_8: (dist :0.01294)
	 - Hopes for longer instalment period with lower amount from CPF.
sentence_9: (dist :0.01017)
	 - Proposes 400- 600 monthly instalment for a period of 1 and a half years ( letter by a lawyer to make request ) Will CPF charge her on the 16th March?
sentence_10: (dist :0.00995)
	 - What if Adverse Party withdraws the charge?
sentence_11: (dist :0.00873)
	 - What are the sentencing options.
sentence_12: (dist :0.00792)
	 - Applicant has been served a letter stating she has to appear in court.
sentence_13: (dist :0.00779)
	 - Should he engage a lawyer?
sentence_14: (dist :0.00649)
	 - Can a friend write the mitigation plea?
sentence_15: (dist :0.00626)
	 - Is there a recommendation for a lawyer?
sentence_16: (dist :0.00603)
	 - What are their legal positions currently?
sentence_17: (dist :0.00533)
	 - Applicant wants to know if there is financial aid.
sentence_18: (dist :0.00517)
	 - How can the applicant re-appeal?
sentence_19: (dist :0.00494)
	 - Whether the judges at the courtrooms are a permanent fixture?
sentence_20: (dist :0.0047)
	 - The applicant questioned on general follow up procedures.
sentence_21: (dist :0.00458)
	 - Was the maintenance of the blue bin that of the Applicant?
sentence_22: (dist :0.00428)
	 - What are my rights?
sentence_23: (dist :0.00408)
	 - With the law firm's withdrawal of action, is he still liable?
sentence_24: (dist :0.00376)
	 - Also, will the punishment be hefty?
sentence_25: (dist :0.00353)
	 - Withdrawal of case.
sentence_26: (dist :0.00349)
	 - How should Applicant go about from here?
sentence_27: (dist :0.00293)
	 - Is this case worth fighting for?
sentence_28: (dist :0.00218)
	 - Should client claim trial or plead guilty?
sentence_29: (dist :0.00161)
	 - Can somebody else represent him?
sentence_30: (dist :0.00156)
	 - Whether client has any recourse against the person?
sentence_31: (dist :0.00106)
	 - Plead guilty?

**keywords:**
action, legal rights, previous marriage, financial difficulties, sentencing options, high court, next hearing, lawyer, mitigation plea, permanent fixture, installments, help, other arrangements, such false visas amount, own work, letter, charge, court fines, other punishments, fine, applicant, court hearing, lower amount, agc, other employers, work, criminal charges, court, request, criminal motion, potential fine



Casetype: Others (61 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.02163)
	 - Applicant wants advice regarding his court case.
sentence_2: (dist :0.01596)
	 - There are 7 charges here.
sentence_3: (dist :0.01585)
	 - How should A deal with the charge?
sentence_4: (dist :0.01392)
	 - ( This is for the baby bonus money ) Applicant's wife is a non-Singaporean and ca n't be the trustee
sentence_5: (dist :0.01335)
	 - Can the client's son be charged for having sexual relationship?
sentence_6: (dist :0.01277)
	 - Applicant seeks advice on the charges and punishement she is facing.
sentence_7: (dist :0.01252)
	 - Is there issues of time bar?
sentence_8: (dist :0.01215)
	 - Adverse Party's son has admitted to charges.
sentence_9: (dist :0.01181)
	 - Applicant wants to declare himself trustee for a bank account he wants to open for his kid.
sentence_10: (dist :0.01131)
	 - Legal issues Any claims against the family for shouting at her?
sentence_11: (dist :0.01112)
	 - But the case here seems complicated.
sentence_12: (dist :0.01025)
	 - . Applicant also wants his real estate license back- he was an agent until he was convicted.
sentence_13: (dist :0.00931)
	 - Can the applicant get the ring back?
sentence_14: (dist :0.00833)
	 - Applicant is advised to file a magistrate's complaint at the crime registry.
sentence_15: (dist :0.00805)
	 - The applicant is enquiring her position in this situation.
sentence_16: (dist :0.00743)
	 - Legality of breaking the lock to enter a property in order to enforce a judgment sum.
sentence_17: (dist :0.00687)
	 - Lawyers may be able to renegotiate for charges to fall under reduced charges.
sentence_18: (dist :0.00657)
	 - Other issues: 1.
sentence_19: (dist :0.00593)
	 - These are technical knowledge ( e.g. concurrent vs consecutive sentences ).
sentence_20: (dist :0.0054)
	 - Since Adverse Party says that son acts on impulse, so there need for evidence of all the mitigating factors.
sentence_21: (dist :0.00513)
	 - Why is the police involved in this private dispute.
sentence_22: (dist :0.00466)
	 - Next course of action.
sentence_23: (dist :0.00333)
	 - Magistrate will write to the police to investigate.
sentence_24: (dist :0.00298)
	 - Will he go to jail?
sentence_25: (dist :0.00286)
	 - How to protect the mother's property from writ of seizure?

**keywords:**
bank account, baby bonus money, sentence, pg cases, private dispute, judgment sum, agc applicant, brother, crime registry, money, offender, legal aid bureau, course, charges, sexual relationship, adverse party, legal recourse, son, advice, court case, home ownership, applicant, claim, joint account, account, jail time, real estate license, case, personal protection order, client, time bar



Casetype: Tenancy Disputes (53 cases)

Column used: advice
**excerpts:**
sentence_1: (dist :0.03167)
	 - Breach of tenancy agreement.
sentence_2: (dist :0.02657)
	 - Refund of tenancy deposit as agreed under lease.
sentence_3: (dist :0.02424)
	 - Fulfilment of tenancy agreement Can the applicants make the tenants pay for the new water heater?
sentence_4: (dist :0.02164)
	 - Under the clause, which causes the applicants to pay for damages below $ 150.
sentence_5: (dist :0.02072)
	 - It is not clear if the lease agreement was registered, or if stamp duty was paid.
sentence_6: (dist :0.0203)
	 - Applicant would like to find out if she can obtain her deposit.
sentence_7: (dist :0.02005)
	 - How does applicant evict the tenant?
sentence_8: (dist :0.0178)
	 - How can the applicant recover monies owed by the tenant.
sentence_9: (dist :0.01779)
	 - Early termination of the 1 year lease.
sentence_10: (dist :0.01193)
	 - Whether a deposit paid can be refunded?
sentence_11: (dist :0.01193)
	 - The applicant questions on the categorization of the splashing white paint on the front door.
sentence_12: (dist :0.01066)
	 - Applicant seeks advice on what to do with the personal belongings.
sentence_13: (dist :0.01054)
	 - Any recourse for entering tenants' room without permission.
sentence_14: (dist :0.01049)
	 - At the joint inspection, the landlord pointed out some damages caused by the couple.
sentence_15: (dist :0.00984)
	 - Baby was born prematurely, can he claim damages?
sentence_16: (dist :0.00909)
	 - What is the result of the dispute resolution clause?
sentence_17: (dist :0.00824)
	 - Can we file a claim under the small claims tribunal?
sentence_18: (dist :0.0064)
	 - LOI has' subject to contract' clause.

**keywords:**
goodwill deposit, new agreement, landlord, former tenants, reparation costs, year lease, rent, amount, money, lease agreement, damages, applicant claim, deposit lease agreement, applicant, tenant, small claims, rental deposit applicant, couple, exaggerated costs, dispute resolution clause, tenancy agreement, practical recourse, additional damages, stamp duty material, agreement, few months, term lease, costs, singapore land authority, parties, contract

Synposis only

In [16]:
for casetype, num_cases in top_n_casestypes:
    print('\n\n\nCasetype: ' + 
          casetype + 
          ' (' + 
          str(num_cases) + 
          ' cases)')
    textrank_generate(df, casetype, col='synopsis')


Casetype: General Divorce Proceedings (391 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.03886)
	 - The applicant's husband has filed for divorce.
sentence_2: (dist :0.0365)
	 - The applicant would like to divorce her husband.
sentence_3: (dist :0.03503)
	 - Divorce issue.
sentence_4: (dist :0.03469)
	 - The applicant had a divorce case 10 years ago.
sentence_5: (dist :0.03377)
	 - Applicant first divorced his first wife in 2007.
sentence_6: (dist :0.03347)
	 - . Applicant would like to file a divorce.
sentence_7: (dist :0.03294)
	 - Applicant petitioned for divorce.
sentence_8: (dist :0.03248)
	 - Regarding applicant's Divorce.
sentence_9: (dist :0.03195)
	 - - Applicant just finalized her divorce.-
sentence_10: (dist :0.03012)
	 - Married for 30 years, husband wants to file for divorce.
sentence_11: (dist :0.02992)
	 - Applicant has a child with the husband.
sentence_12: (dist :0.02966)
	 - Applicant has an outstanding divorce issue.
sentence_13: (dist :0.02762)
	 - The applicant has 2 children ( 2 and 4 years old ).
sentence_14: (dist :0.02752)
	 - Applicant came to advice on divorce proceedings.
sentence_15: (dist :0.0273)
	 - Applicant's wife (' the wife' ) is requesting for a divorce.
sentence_16: (dist :0.02713)
	 - However, despite the client's requests, the wife had yet to officially file a divorce.
sentence_17: (dist :0.02697)
	 - Applicant is asking for a divorce.
sentence_18: (dist :0.02695)
	 - There has been no divorce yet.
sentence_19: (dist :0.02678)
	 - Client has been divorced for 4 years.
sentence_20: (dist :0.02656)
	 - 2 years ago, client divorced in China.

**keywords:**
husband, singapore pr, custody wife, divorce proceeding, case file, vietnamese wife, general divorce proceedings, child ’s upbringing, have file, estranged husband, divorce issue, process husband, child ’s contact number, years old, divorce case, flat applicant, year, applicant, year old son, applicant divorce proceedings, own lawyer advice, ex husband, wife, short marriage, client husband, divorce papers, divorce, fast track divorce, house applicant, client, child expenses



Casetype: Bankruptcy / DRS (290 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.03146)
	 - Bank filed bankruptcy against applicant.
sentence_2: (dist :0.02996)
	 - Banks will not file bankruptcy against him.
sentence_3: (dist :0.02547)
	 - Applicant facing bankruptcy.
sentence_4: (dist :0.02435)
	 - Applicant applied for bankruptcy.
sentence_5: (dist :0.02395)
	 - The bank is suing her for bankruptcy.
sentence_6: (dist :0.02335)
	 - Debt of $ 46,000, owed to a bank.
sentence_7: (dist :0.02308)
	 - Total debt owed by Applicant: About $ 160K. Total creditors: about 10 banks.
sentence_8: (dist :0.02262)
	 - Applicant has outstanding debts with 7 other banks as well.
sentence_9: (dist :0.02253)
	 - A bank has filed a bankruptcy application to make the applicant a bankrupt.
sentence_10: (dist :0.02234)
	 - Applicant wants to self-declare bankruptcy.
sentence_11: (dist :0.02214)
	 - Applicant owe the banks around $ 92,000.
sentence_12: (dist :0.02202)
	 - Applicant came from a bankruptcy hearing.
sentence_13: (dist :0.02199)
	 - . Applicant wants to file for bankruptcy.
sentence_14: (dist :0.02186)
	 - Bankruptcy matter.
sentence_15: (dist :0.02124)
	 - Applicant is filing for bankruptcy.
sentence_16: (dist :0.02121)
	 - Both of them are filing for bankruptcy due to their personal debt.
sentence_17: (dist :0.0209)
	 - The applicant applied for personal insolvency ( bankruptcy ).
sentence_18: (dist :0.0208)
	 - BC bank applied for statutory bankruptcy.
sentence_19: (dist :0.02077)
	 - Applicant ordered bankruptcy today.
sentence_20: (dist :0.02076)
	 - Bankruptcy by CD bank took priority of that.
sentence_21: (dist :0.02029)
	 - Applicant owes $ 80,000-$90,000 of debt
sentence_22: (dist :0.02022)
	 - Applicant has filed for bankruptcy but his debt is less than $ 100 000.
sentence_23: (dist :0.02005)
	 - Applicant owes money to several banks.
sentence_24: (dist :0.02005)
	 - Now he faces bankruptcy proceedings.
sentence_25: (dist :0.02002)
	 - Applicant wishes to apply for bankruptcy.
sentence_26: (dist :0.0199)
	 - The applicant has declared bankruptcy.
sentence_27: (dist :0.01946)
	 - Bankruptcy: Applicant's company ( sole proprietor ) is being sued by another company.
sentence_28: (dist :0.01936)
	 - Applicant took a commercial term loan from the bank.
sentence_29: (dist :0.01918)
	 - She came in to understand about the bankruptcy proposal and debt proceedings.
sentence_30: (dist :0.01914)
	 - The applicant has not attended any bankruptcy hearings.
sentence_31: (dist :0.01904)
	 - The court proceeded as the applicant himself applied for bankruptcy, not the creditor.
sentence_32: (dist :0.01877)
	 - The applicant is a retiree and is now filing for a bankruptcy
sentence_33: (dist :0.01841)
	 - The applicant is being sued by a vehicle leasing company for bankruptcy.
sentence_34: (dist :0.01808)
	 - Applicant needs advise in filing up the bankruptcy form.
sentence_35: (dist :0.0176)
	 - Applicant wants to file for bankruptcy on her own behalf.
sentence_36: (dist :0.01756)
	 - Applicant received summons ( one dated 9 May, the other dated 10 May ) from two banks for credit card debts ( $ 20,000 + each ).
sentence_37: (dist :0.01739)
	 - This is an individual debt from a moneylender ( not a bank ).
sentence_38: (dist :0.01707)
	 - Applicant had his first bankruptcy court hearing today.

**keywords:**
outstanding debt, bankruptcy proceedings, common applicant, sum, approached applicant, amount, application, loan agreement, applicant money, taxi technology companies, bank, file, bankruptcy, payment, bankruptcy application, personal bankruptcy, simple loan agreement, applicant, company stamp, self-declared bankrupt, other vendors, repayment scheme, hearing, debt repayment scheme, constant debt, pay, current pay, different banks, other banks, ongoing business, state courts



Casetype: Maintenance (168 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.05479)
	 - Issue here is maintenance.
sentence_2: (dist :0.05278)
	 - The maintenance is for the child.
sentence_3: (dist :0.04882)
	 - The maintenance was $ 500.
sentence_4: (dist :0.04469)
	 - Maintenance fee is $ 500 per month.
sentence_5: (dist :0.04312)
	 - Applicant is here regarding maintenance issues ( $ 700/month ).
sentence_6: (dist :0.04204)
	 - Maintenance fees in a divorce.
sentence_7: (dist :0.04164)
	 - Court granted maintenance of 400 for 1 child.
sentence_8: (dist :0.04073)
	 - Applicant's child is 1.5 years old and is claiming 1k per month in maintenance.
sentence_9: (dist :0.0404)
	 - However, the order states that no maintenance is to be paid.
sentence_10: (dist :0.0398)
	 - Client is divorced and now have a child maintenance issue.
sentence_11: (dist :0.03951)
	 - Maintenance for ex-wife.
sentence_12: (dist :0.03852)
	 - In 2010, she got a maintenance order.
sentence_13: (dist :0.03838)
	 - Enquiry about maintenance.
sentence_14: (dist :0.03828)
	 - After his divorce, he was supposed to pay $ 1,000 in maintenance.
sentence_15: (dist :0.03789)
	 - Monthly maintenance to wife and children $ 1001 per month. $ 1000 for children, $ 1 for wife.
sentence_16: (dist :0.03759)
	 - He's seeking to lower maintenance from $ 700 to a lower amount.
sentence_17: (dist :0.03706)
	 - Maintenance was not ordered in Syariah court in any documentation.
sentence_18: (dist :0.03538)
	 - Client is unable to pay $ 800 maintenance fees.
sentence_19: (dist :0.03524)
	 - This concerns variation of child maintenance fee.
sentence_20: (dist :0.03455)
	 - The applicant wishes to claim against her ex-husband for the maintenance of her children.
sentence_21: (dist :0.0345)
	 - - Applicant is here regarding maintenance of his son.
sentence_22: (dist :0.03445)
	 - Applicant is divorced and is paying maintenance of $ 300 and 50% of expenses for childcare.
sentence_23: (dist :0.03347)
	 - Has an existing maintenance order.
sentence_24: (dist :0.03239)
	 - The client seeks advise on child maintenance.
sentence_25: (dist :0.03209)
	 - Applicant seeking to vary maintenance order.
sentence_26: (dist :0.03163)
	 - Has been paying maintenance to ex-wife from 2009.
sentence_27: (dist :0.03096)
	 - Ex-spouse filed for a variation of the maintenance order.

**keywords:**
maintenance fees, husband, children, similar pay, lower pay, 's financial issues, court order, claim maintenance, enforcement order, family court, 1st payment, outstanding maintenance, years old, evidence applicant, maintenance order, applicant, child maintenance, years, third child, year old son, judgment order-maintenance amount, maintenance variation, work, first month, current maintenance, wife, maintenance, divorce, current pay, exact month unknown, client



Casetype: Custody / Child Access (142 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.05081)
	 - Two children, one is 9 and one is 11.
sentence_2: (dist :0.05081)
	 - Child will be 5 soon.
sentence_3: (dist :0.03924)
	 - Applicant and children are Singaporeans.
sentence_4: (dist :0.03918)
	 - Interim joint custody and access of the child.
sentence_5: (dist :0.03886)
	 - The custody of 8 year old child is shared by them.
sentence_6: (dist :0.03853)
	 - Her children are aged 13 years, 17 years and 18 years.
sentence_7: (dist :0.03492)
	 - The applicant is facing divorce, she wanted a custody for the child.
sentence_8: (dist :0.03446)
	 - Breach of access to the child against ex-husband.
sentence_9: (dist :0.03436)
	 - The wife took away her 2 children.
sentence_10: (dist :0.03281)
	 - Applicant is afraid of safety of child.
sentence_11: (dist :0.03275)
	 - ( 7/3/2017-AM ) Given child access of once weekly.
sentence_12: (dist :0.03234)
	 - He usually sees his children once a month.
sentence_13: (dist :0.03174)
	 - Have overnight and weekend access to the child.
sentence_14: (dist :0.0291)
	 - . Applicant has an autistic 13 yo child.
sentence_15: (dist :0.02779)
	 - The children are Singaporean citizens who were born here.
sentence_16: (dist :0.02775)
	 - Child did not mention that she was uncomfortable.
sentence_17: (dist :0.02589)
	 - Police reports were filed.

**keywords:**
current husband, year old child, access, month old child, k2 child, child access, joint custody, reasonable access, divorce proceeding, god-sister/infant care, child abuse, control, family court, youngest child, child protection officer, son, applicant, interim order, year olds, years, father, wife yesterday, child, wife, daughter, care, divorce, been reports, personal protection order, divorce applicant, interim custody



Casetype: Magistrate's Complaints & Private Summons (104 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.02586)
	 - Applicant owes $ 20,000.
sentence_2: (dist :0.02265)
	 - Applicant has his medical reports.
sentence_3: (dist :0.02157)
	 - Subsequently, Applicant's boss suggested that he report this to the police.
sentence_4: (dist :0.02053)
	 - The applicant filed for a police report a few days later.
sentence_5: (dist :0.01901)
	 - The applicant has filed a magistrate complaint.
sentence_6: (dist :0.01854)
	 - Applicant wants to sue him.
sentence_7: (dist :0.01849)
	 - The applicant can also speak Vietnamese.
sentence_8: (dist :0.01841)
	 - Applicant had a girlfriend in 2005.
sentence_9: (dist :0.0177)
	 - They interviewed the applicant regarding his issue.
sentence_10: (dist :0.01695)
	 - The applicant however, alleges that the story by the other party is almost entirely fabricated.
sentence_11: (dist :0.01686)
	 - The applicants were also fined.
sentence_12: (dist :0.01663)
	 - Applicant filed magistrate's complaint with regards to harassment against her for 2 years.
sentence_13: (dist :0.01615)
	 - The police has referred the applicant to the magistrate courts due to insufficient evidence.
sentence_14: (dist :0.01606)
	 - Once harassment began, the Applicant moved to another gallery.
sentence_15: (dist :0.01598)
	 - The applicant was assaulted in school by his classmate.
sentence_16: (dist :0.0159)
	 - Applicant wishes to demand for reasonable compensation.
sentence_17: (dist :0.01581)
	 - The applicant owns a shop, where his worker works.
sentence_18: (dist :0.01579)
	 - Every month, applicant was paid back $ 1,500.
sentence_19: (dist :0.01577)
	 - The applicant knows the identity of the assailant.
sentence_20: (dist :0.01568)
	 - Applicant has never talked to Adverse Party about these.
sentence_21: (dist :0.01567)
	 - - Applicant confronted AP after the chemical spray.
sentence_22: (dist :0.01561)
	 - Applicant has documents from the Hospital.
sentence_23: (dist :0.01534)
	 - Applicant rented a camera to a Adverse Party under a contract.
sentence_24: (dist :0.01528)
	 - Applicant is being charged under s509 without evidence and was locked up.
sentence_25: (dist :0.01523)
	 - The applicant seeks legal advice as against the Youtuber.
sentence_26: (dist :0.01507)
	 - Applicant was assaulted by members of a secret society.
sentence_27: (dist :0.01483)
	 - the worker walked away, but the applicant kept walking.
sentence_28: (dist :0.01477)
	 - Applicant clamped the wheel of a man's car.
sentence_29: (dist :0.01434)
	 - Applicant claimed that he was attacked 10 year ago.
sentence_30: (dist :0.01414)
	 - The applicant is living alone with her mother.
sentence_31: (dist :0.01404)
	 - The victim is the applicant's sister.
sentence_32: (dist :0.01399)
	 - Applicant was bullied (? ) by his friends.
sentence_33: (dist :0.01396)
	 - Applicant lives with a flat partner ( Adverse Party ).
sentence_34: (dist :0.01394)
	 - The applicant has attended two mediation sessions between the applicant and the complainant.
sentence_35: (dist :0.01381)
	 - The applicants has already filed skeletal arguments etc.
sentence_36: (dist :0.01355)
	 - Applicant claims that Social Services made false claims against him
sentence_37: (dist :0.01338)
	 - . Applicant wants to lodge MAG Complaint a Security guard at Condo.
sentence_38: (dist :0.01332)
	 - Applicant complained that he was hit by his neighbor.
sentence_39: (dist :0.01319)
	 - The applicant refuses a plain apology and wants to claim damages.
sentence_40: (dist :0.01315)
	 - - Police asked applicant to go to Magistrate to complain after AP voluntarily caused hurt.-
sentence_41: (dist :0.01302)
	 - Applicant has approached the Magistrate ’s counter to file a complaint.
sentence_42: (dist :0.013)
	 - Applicant got assaulted on her legs, knees and face.

**keywords:**
subsequent actions, other party, neighborhood police station, claims, other documentation, letter boxes, policeman applicant, applicant son, lawyer, magistrates, days mc, applicant, phone calls, police report, medical report, time applicant, applicant applicant, work, applicant niece, police, complaint, grievous injuries, court, sufficient evidence, assault, full name, case, parties, piece, client, car



Casetype: Traffic Violations (103 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.02617)
	 - Applicant was charged for traffic offence.
sentence_2: (dist :0.02499)
	 - Applicant asked the court to concurrently charge all the traffic offences.
sentence_3: (dist :0.02341)
	 - Charged for dangerous driving, car accident.
sentence_4: (dist :0.02139)
	 - ( 6/3/2017-PM ) Applicant is currently charged with dangerous driving.
sentence_5: (dist :0.02019)
	 - Traffic offence.
sentence_6: (dist :0.01957)
	 - The applicant is being charged 2 cases.
sentence_7: (dist :0.01866)
	 - There are three charges against the Applicant for Drink driving offence.
sentence_8: (dist :0.01848)
	 - Applicant wishes to reduce his charge of dangerous driving.
sentence_9: (dist :0.01836)
	 - The applicant was involved in a traffic accident.
sentence_10: (dist :0.01815)
	 - Charges are driving without a license.
sentence_11: (dist :0.01767)
	 - Charged with dangerous driving as an uber driver during day time.
sentence_12: (dist :0.01757)
	 - Applicant was charged with a hit-and-run accident.
sentence_13: (dist :0.01615)
	 - It is likely Road Traffic Act.
sentence_14: (dist :0.01502)
	 - Applicant's driving license was previously revoked for drunk driving.
sentence_15: (dist :0.01502)
	 - The client drove against the flow of traffic.
sentence_16: (dist :0.01494)
	 - Criminal Revision ( Traffic Offence ).
sentence_17: (dist :0.01487)
	 - The Applicant subsequently drove his friend to the hospital without a license.
sentence_18: (dist :0.01476)
	 - The applicant has no antecedent charges before this current case.
sentence_19: (dist :0.01428)
	 - He admitted to all six charges.
sentence_20: (dist :0.01361)
	 - The applicant however works as a driver.
sentence_21: (dist :0.01358)
	 - Applicant hit a taxi while drink driving ( second offence ).
sentence_22: (dist :0.01348)
	 - This is the applicant's first offence.
sentence_23: (dist :0.01319)
	 - Applicant was driving a taxi.
sentence_24: (dist :0.01288)
	 - Applicant claims that he was accused of driving a car without a car insurance.
sentence_25: (dist :0.01285)
	 - While he served his sentence, he was charged again.
sentence_26: (dist :0.01244)
	 - Client admits to all charges.
sentence_27: (dist :0.01223)
	 - Traffic offence-charged under s 43(4 ) RTA.
sentence_28: (dist :0.01221)
	 - A is charged under the Road Traffics Act and subsequently sentenced with a suspension from driving for 30 months ( since August 10 ).
sentence_29: (dist :0.01143)
	 - Accident case.

**keywords:**
victims, reckless driving, traffic police, recent charge, harsh sentence, small surgery applicant, 5th charge, valid license, police officers, first offence, charge, traffic, motor accident case-motorcyclist passenger, road traffic act, applicant, drive, years, drunk driving, car insurance, traffic violations cases, demerit points, second time, charge slip, court, applicant enquires, driver, company vehicle, dangerous driving, small fine, client, car



Casetype: Departmental/Statutory Board Charges & Summonses (78 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.02763)
	 - Applicant was charged in Court 26, but it is unclear what exactly, his charges are.
sentence_2: (dist :0.0254)
	 - Charged in Court 23.
sentence_3: (dist :0.0241)
	 - 3 charges against the applicant.
sentence_4: (dist :0.024)
	 - 3rd Jan-attended Court for 3 charges.
sentence_5: (dist :0.02388)
	 - He was charged over $ 90000 for GST.
sentence_6: (dist :0.02313)
	 - Applicant is of company.
sentence_7: (dist :0.0229)
	 - This is the applicant's first offence.
sentence_8: (dist :0.02219)
	 - Applicant is charged, bailed by her father.
sentence_9: (dist :0.02125)
	 - Applicant is not working currently.
sentence_10: (dist :0.02124)
	 - 10 charges was reduced to 8 charges.
sentence_11: (dist :0.01931)
	 - He is facing 3 charges in total.
sentence_12: (dist :0.01793)
	 - The PP will be proceeding on 4 charges only.
sentence_13: (dist :0.01793)
	 - Applicant is a bankrupt
sentence_14: (dist :0.01791)
	 - The court date is at 9:30am tomorrow.
sentence_15: (dist :0.01787)
	 - The applicant continued to operate her business without a license, resulting in her being charged.
sentence_16: (dist :0.01733)
	 - $ 9,000 charged per false advertisement which was given.
sentence_17: (dist :0.01726)
	 - Applicant is charged for pasting advertisements in several places in Singapore from the years 2010- 2012.
sentence_18: (dist :0.01718)
	 - The first charge sheet stated that the applicant could compound the offence.
sentence_19: (dist :0.01683)
	 - Applicant has been charged with 30 counts under the EA.
sentence_20: (dist :0.01662)
	 - Applicant had been sentenced for two charges for a fake marriage.
sentence_21: (dist :0.01662)
	 - The applicant is facing 4 charges for submitting forged academic certificates.
sentence_22: (dist :0.01574)
	 - Applicant is facing charges from MOM and CPF on outstanding arrears and has court hearings on 16 and 21 March 2017.
sentence_23: (dist :0.01572)
	 - Applicant then received 2 charges more than a year later.
sentence_24: (dist :0.01562)
	 - Applicant is their only caregiver.
sentence_25: (dist :0.01549)
	 - Applicant has been to the hearing.
sentence_26: (dist :0.01545)
	 - Applicant was told by LTA to just turn up to court after speaking to them.
sentence_27: (dist :0.01505)
	 - First investigation was in February.
sentence_28: (dist :0.01497)
	 - The fine is $ 3000-6000
sentence_29: (dist :0.01478)
	 - Second and third charge under consideration.
sentence_30: (dist :0.01465)
	 - 2 charges for immigration offences.
sentence_31: (dist :0.01448)
	 - - Applicant was issued letters of demand and Form 37.
sentence_32: (dist :0.01425)
	 - The applicant was fined for high-rise littering.
sentence_33: (dist :0.01407)
	 - MOM has charged 20 times Applicant on 31st October.
sentence_34: (dist :0.01406)
	 - The client was a director of a company.
sentence_35: (dist :0.01382)
	 - Charged with offence of spitting.
sentence_36: (dist :0.01372)
	 - In 2013, he was hospitalized.
sentence_37: (dist :0.01346)
	 - Applicant had 2 marriages in China, but first marriage was not dissolved.
sentence_38: (dist :0.01326)
	 - He is faced with 24 charges. between the period of October 2015 and August 2016,
sentence_39: (dist :0.01307)
	 - Her license was revoked.
sentence_40: (dist :0.01299)
	 - Applicant was to recover his passport despite investigation.
sentence_41: (dist :0.01296)
	 - Applicant faces one charge from the IRAS, regarding GST regulation.
sentence_42: (dist :0.01296)
	 - She is married with a child and 11 years old this year.
sentence_43: (dist :0.01294)
	 - Applicant has been served a letter stating her offence is a non-compoundable offence.
sentence_44: (dist :0.01281)
	 - Applicant is required to pay $ 200 as a compounded fine.
sentence_45: (dist :0.01272)
	 - His house is under repossession.

**keywords:**
claims, been rumors, singapore company, next court session, first charge, mom, trademark act, charges, applicant last, first charge sheet, letter, nea, offence, times applicant, years old, company, fine, applicant, original charge, years, business, 11th april, work, lower instalment amount, 3rd jan-attended court, privaet hire car driver driver, cpf conviction, court, house, same time, third charge



Casetype: Others (61 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.01154)
	 - 9 charges in total.
sentence_2: (dist :0.01099)
	 - Both Applicant charged under S8(2 ) of Common Gaming House Act.
sentence_3: (dist :0.01087)
	 - Applicant incurred a late charge from his bank.
sentence_4: (dist :0.01032)
	 - The applicant has a criminal charge against her for a conspiracy.
sentence_5: (dist :0.00937)
	 - The client has been charged with dog abandonment.
sentence_6: (dist :0.0086)
	 - The applicant is involved in a case between a government school and an internship company.
sentence_7: (dist :0.00855)
	 - The applicant has not enforced the order for over four years.
sentence_8: (dist :0.00821)
	 - Applicant had a criminal case a few years ago.
sentence_9: (dist :0.0081)
	 - Applicant faces 42 charges under the Employment Act, proceeding on 15 charges and the rest taken into consideration.
sentence_10: (dist :0.00759)
	 - They claimed that they were forced to sign on the charge sheet.
sentence_11: (dist :0.00752)
	 - Applicant acted as a middleman.
sentence_12: (dist :0.00731)
	 - The applicant had a hearing at court 14 last month.
sentence_13: (dist :0.00701)
	 - Applicant organized a poker session with his friends, and was subsequently contacted by the police and charged.
sentence_14: (dist :0.00669)
	 - Client has attended court hearings.
sentence_15: (dist :0.00668)
	 - Charged under s 182 of the Penal Code ( giving public servant false information ).
sentence_16: (dist :0.0066)
	 - Charged with possession of weapon in public.
sentence_17: (dist :0.00649)
	 - Applicant's daughter ran away from home.
sentence_18: (dist :0.00628)
	 - Hence, the client is seeking to appeal against the judge's order.
sentence_19: (dist :0.00615)
	 - need to attend court. gambling offence. charged for hosting gambling but was actually playing. ask whether he should get a lawyer.
sentence_20: (dist :0.00563)
	 - Applicant owing about $ 6000.
sentence_21: (dist :0.00553)
	 - The applicant has a court trial pending.
sentence_22: (dist :0.0055)
	 - The applicant is not eligible for legal aid from the Legal Aid Bureau.
sentence_23: (dist :0.00536)
	 - Applicant owns a cat cafe.
sentence_24: (dist :0.00535)
	 - He has an order of arrest under Section 174 of Chapter 224.
sentence_25: (dist :0.00513)
	 - Son entered secondary school last year and had a hard time adjusting.

**keywords:**
friend, singapore, false information, eviction order, family court issue, government school, money, court order, normal charges, criminal case, dog abandonment, help, police officer, charge, few years, son, company, applicant, prc lawyer, ava, harassment act, late charges, family development, child, first time client, internship company, legal actions, nursing home, order, client, injury claim



Casetype: Tenancy Disputes (53 cases)

Column used: synopsis
**excerpts:**
sentence_1: (dist :0.03552)
	 - Applicant took the matter to court and the tenant was ordered by the court to pay arrears.
sentence_2: (dist :0.03347)
	 - Applicant is the landlord that rented his property to the tenant.
sentence_3: (dist :0.03213)
	 - Applicant is the tenant.
sentence_4: (dist :0.03101)
	 - Rental issue: Applicant is tenant.
sentence_5: (dist :0.02769)
	 - As of now, the tenant can not be reached.
sentence_6: (dist :0.02769)
	 - Landlord and Tenant Dispute.
sentence_7: (dist :0.0275)
	 - The tenancy agreement is expiring in 1 month.
sentence_8: (dist :0.02667)
	 - The deposit was 1 months' worth of the rent, amounting to about $ 1,500.
sentence_9: (dist :0.02579)
	 - Applicant is a subtenant who rented a unit from a tenant.
sentence_10: (dist :0.02463)
	 - The landlord turned off the wifi whilst the tenant was still using the wifi.
sentence_11: (dist :0.02281)
	 - The tenancy is actually a sub-letting agreement.
sentence_12: (dist :0.02231)
	 - This condominium is shared with 6 other tenants.
sentence_13: (dist :0.02215)
	 - Tenant has been verbally abusive to other tenants.
sentence_14: (dist :0.02168)
	 - Breach of contract between tenant and landlord.
sentence_15: (dist :0.02131)
	 - Applicant's parents are the landlord.
sentence_16: (dist :0.02103)
	 - The landlord holds a 2 month deposit.
sentence_17: (dist :0.02087)
	 - but the rental was settled late based on the tenancy agreement.
sentence_18: (dist :0.01981)
	 - Only verbal agreement between tenant and landlord, did not know landlord beforehand.
sentence_19: (dist :0.01974)
	 - Applicants are a couple and are facing a landlord tenancy dispute.
sentence_20: (dist :0.01939)
	 - The applicant is involved in a tenancy dispute.
sentence_21: (dist :0.0193)
	 - Landlord is demanding $ 2,800 in total for rent and damages.
sentence_22: (dist :0.01863)
	 - Tenant cut off his phone line and is uncontactable.
sentence_23: (dist :0.0183)
	 - Tenant 1: Applicant has a tenant.
sentence_24: (dist :0.01799)
	 - Old lady rented her room out, tenant moved out without paying her the one month rent.
sentence_25: (dist :0.01789)
	 - The deposit was for a 1 room in a 4 room HDB flat.
sentence_26: (dist :0.01777)
	 - Lease is already over.
sentence_27: (dist :0.01748)
	 - Initially, applicant filed a claim against the landlord and was successful in claiming for damages.
sentence_28: (dist :0.01738)
	 - Tenant breached tenancy agreement- to default rental for more than 7 days.

**keywords:**
landlord, deposit, tenant dispute, residential property, rent, months rent, apartment, flat mate, previous landlord, agent, lease agreement, damages, other tenants, previous agreements, tenant, applicant, applicant nationality, small claims, real landlord, property guru, tenancy agreement, rental, february rent, new room, main tenant, house, months deposit, marine sector people, rental house, been court orders, contract

Both Advice and Synopsis

In [17]:
for casetype, num_cases in top_n_casestypes:
    print('\n\n\nCasetype: ' + 
          casetype + 
          ' (' + 
          str(num_cases) + 
          ' cases)')
    textrank_generate(df, casetype, col='both')


Casetype: General Divorce Proceedings (391 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.05029)
	 - Applicant is filing for a divorce.
sentence_2: (dist :0.04966)
	 - The applicant was to filed a divorce with her husband.
sentence_3: (dist :0.04923)
	 - How long is the divorce proceedings?
sentence_4: (dist :0.0461)
	 - Proceedings for divorce?
sentence_5: (dist :0.04517)
	 - Applicant and ex-husband are in divorce proceedings.
sentence_6: (dist :0.04364)
	 - The applicant is not in agreement with the divorce.
sentence_7: (dist :0.04335)
	 - Client has been divorced for 4 years.
sentence_8: (dist :0.04316)
	 - Applicant's wife filed for divorce in 2015.
sentence_9: (dist :0.04196)
	 - Whether there can be divorce proceedings or would it be nullity.
sentence_10: (dist :0.04109)
	 - Applicant's wife (' the wife' ) is requesting for a divorce.
sentence_11: (dist :0.0409)
	 - Divorce has not been filed yet.
sentence_12: (dist :0.04032)
	 - How to file for a divorce?
sentence_13: (dist :0.04027)
	 - A is unemployed and divorced.
sentence_14: (dist :0.04005)
	 - Applicant wants to divorce.
sentence_15: (dist :0.03901)
	 - Wife is threatening divorce.
sentence_16: (dist :0.03899)
	 - Regarding applicant's Divorce.
sentence_17: (dist :0.03854)
	 - - Applicant just finalized her divorce.-
sentence_18: (dist :0.03822)
	 - Applicant is in the pre-trial stage of divorce.
sentence_19: (dist :0.03818)
	 - General divorce proceedings.
sentence_20: (dist :0.03794)
	 - Applicant first divorced his first wife in 2007.
sentence_21: (dist :0.03753)
	 - Will the applicant's PR status be revoked if she divorces her husband?

**keywords:**
husband, divorce suit, applicant approach, current husband, divorce proceeds, lawyer fees, custody wife, child custody, is client, divorce proceeding, custody, have file, many years, divorce proposal, applicant questions, matrimonial flat, applicant file, divorce procedures, years old, applicant, uncontested divorce, child maintenance, ex husband, wife, marriage, is applicant, divorce, local husband, singapore law, lower child maintenance, client



Casetype: Bankruptcy / DRS (290 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.03949)
	 - Bank filed bankruptcy against applicant.
sentence_2: (dist :0.03692)
	 - Should the applicant file for bankruptcy himself?
sentence_3: (dist :0.03517)
	 - Banks will not file bankruptcy against him.
sentence_4: (dist :0.03476)
	 - Applicant facing bankruptcy.
sentence_5: (dist :0.03337)
	 - Applicant applied for bankruptcy.
sentence_6: (dist :0.03183)
	 - . Applicant wants to file for bankruptcy.
sentence_7: (dist :0.03158)
	 - Applicant wants to self-declare bankruptcy.
sentence_8: (dist :0.0307)
	 - Applicant is filing for bankruptcy.
sentence_9: (dist :0.03057)
	 - How should Applicant fill in the forms for a bankruptcy application?
sentence_10: (dist :0.03044)
	 - How to avoid bankruptcy from the bank?
sentence_11: (dist :0.02981)
	 - A bank has filed a bankruptcy application to make the applicant a bankrupt.
sentence_12: (dist :0.02974)
	 - The applicant would like a bankruptcy protection.
sentence_13: (dist :0.02892)
	 - Bankruptcy matter.
sentence_14: (dist :0.0286)
	 - The applicant has declared bankruptcy.
sentence_15: (dist :0.02853)
	 - ( 5 ) When can Applicant be discharged from bankruptcy?
sentence_16: (dist :0.02824)
	 - Applicant came from a bankruptcy hearing.
sentence_17: (dist :0.02823)
	 - Applicant ordered bankruptcy today.
sentence_18: (dist :0.02779)
	 - The bank is suing her for bankruptcy.
sentence_19: (dist :0.02779)
	 - The applicant now wishes to apply for bankruptcy.
sentence_20: (dist :0.02724)
	 - The applicant is a retiree and is now filing for a bankruptcy
sentence_21: (dist :0.02682)
	 - Now he faces bankruptcy proceedings.
sentence_22: (dist :0.02668)
	 - Applicant has outstanding debts with 7 other banks as well.
sentence_23: (dist :0.02659)
	 - The applicant applied for personal insolvency ( bankruptcy ).
sentence_24: (dist :0.02657)
	 - The applicant came in for legal advice on his bankruptcy proposal and debt proceedings.
sentence_25: (dist :0.02607)
	 - Applicant has filed for bankruptcy but his debt is less than $ 100 000.
sentence_26: (dist :0.02555)
	 - Bankruptcy proceedings; process of DRS.
sentence_27: (dist :0.02545)
	 - The court proceeded as the applicant himself applied for bankruptcy, not the creditor.
sentence_28: (dist :0.02543)
	 - Applicant wants to file for bankruptcy on her own behalf.
sentence_29: (dist :0.0253)
	 - What is self-declared bankruptcy?
sentence_30: (dist :0.02492)
	 - Will the applicant's bankruptcy status jeopardise his employment?
sentence_31: (dist :0.02488)
	 - The applicant has not attended any bankruptcy hearings.
sentence_32: (dist :0.02465)
	 - The applicant mainly faces trouble in filling up the bankruptcy forms.
sentence_33: (dist :0.02436)
	 - Bankruptcy by CD bank took priority of that.
sentence_34: (dist :0.02404)
	 - Bankruptcy: Applicant's company ( sole proprietor ) is being sued by another company.
sentence_35: (dist :0.02382)
	 - BC bank applied for statutory bankruptcy.
sentence_36: (dist :0.02355)
	 - Applicant is applying for a voluntary bankruptcy.
sentence_37: (dist :0.02349)
	 - Also, Applicant to be aware of restrictions upon bankruptcy.
sentence_38: (dist :0.02315)
	 - Likely to be bankruptcy, if BC bank knows that 50% of Applicant's assets can satisfy debt.
sentence_39: (dist :0.02299)
	 - The applicant is being sued by a vehicle leasing company for bankruptcy.
sentence_40: (dist :0.02266)
	 - Applicant owe the banks around $ 92,000.
sentence_41: (dist :0.02261)
	 - Bankruptcy: Only SD served, no application for bankruptcy yet.
sentence_42: (dist :0.02239)
	 - Went for court to file for bankruptcy on 23 /2.
sentence_43: (dist :0.02236)
	 - Total debt owed by Applicant: About $ 160K. Total creditors: about 10 banks.
sentence_44: (dist :0.0221)
	 - How to go about the bankruptcy process.
sentence_45: (dist :0.022)
	 - The applicant was discharged from his first bankruptcy 8 years ago.
sentence_46: (dist :0.02197)
	 - Applicant seeks to vary the monthly contribution under his bankruptcy.
sentence_47: (dist :0.02196)
	 - Client filing for bankruptcy.
sentence_48: (dist :0.02182)
	 - Restrictions after declaring bankruptcy.
sentence_49: (dist :0.02171)
	 - Applicant had his first bankruptcy court hearing today.
sentence_50: (dist :0.02159)
	 - Banks offered debt restructuring, applicant refused the debt restructuring.

**keywords:**
bankrupt person, bankruptcy application applicant, debt, bankruptcy proceedings, other bank accounts, proper payment, amount, creditor, dormant company, court order, debt restructuring scheme, bankruptcy application form, bank, self-declared bankruptcy process applicant, court issue, other outstanding debts, bankrupt due, bankruptcy application, applicant, bankruptcy claim, applicant files, bankruptcy judgment, self declared bankruptcy applicant, housing loans, false company, bankrupt, banking loans, bankruptcy suit, pay, other banks, sole-proprietorship business



Casetype: Maintenance (168 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.06251)
	 - The maintenance is for the child.
sentence_2: (dist :0.05342)
	 - The maintenance was $ 500.
sentence_3: (dist :0.05203)
	 - Issue here is maintenance.
sentence_4: (dist :0.0499)
	 - Client is here to enquire about his maintenance.
sentence_5: (dist :0.04937)
	 - Whether she may file for child maintenance.
sentence_6: (dist :0.04625)
	 - Maintenance fee is $ 500 per month.
sentence_7: (dist :0.04617)
	 - Court granted maintenance of 400 for 1 child.
sentence_8: (dist :0.04603)
	 - However, the order states that no maintenance is to be paid.
sentence_9: (dist :0.04516)
	 - Client is unable to pay $ 800 maintenance fees.
sentence_10: (dist :0.0439)
	 - In 2010, she got a maintenance order.
sentence_11: (dist :0.04288)
	 - Applicant is here regarding maintenance issues ( $ 700/month ).
sentence_12: (dist :0.04285)
	 - The client seeks advise on child maintenance.
sentence_13: (dist :0.04267)
	 - Applicant's child is 1.5 years old and is claiming 1k per month in maintenance.
sentence_14: (dist :0.04249)
	 - Maintenance was not ordered in Syariah court in any documentation.
sentence_15: (dist :0.04144)
	 - Applicant was ordered to pay maintenance for his wife and his youngest daughter ( $ 600/month each ).
sentence_16: (dist :0.04131)
	 - He's seeking to lower maintenance from $ 700 to a lower amount.
sentence_17: (dist :0.04075)
	 - Monthly maintenance to wife and children $ 1001 per month.
sentence_18: (dist :0.03976)
	 - Maintenance fees in a divorce.
sentence_19: (dist :0.03945)
	 - What are the various considerations of a court in a variation of a maintenance order?
sentence_20: (dist :0.03937)
	 - The maintenance amount only for ex-wife.
sentence_21: (dist :0.03827)
	 - The court order was for $ 800.
sentence_22: (dist :0.03797)
	 - This concerns variation of child maintenance fee.
sentence_23: (dist :0.03746)
	 - Has an existing maintenance order.
sentence_24: (dist :0.03732)
	 - Enquiry about maintenance.
sentence_25: (dist :0.03717)
	 - Applicant seeking to vary maintenance order.
sentence_26: (dist :0.03664)
	 - How can she stop paying maintenance?
sentence_27: (dist :0.03644)
	 - The client is divorced.

**keywords:**
husband, maintenance fees, children, upcoming court session, similar pay, lower pay, is client, 's financial issues, payment, years old, maintenance court order, maintenance order, applicant, divorce order, child maintenance, child maintenance sum, years, custody order, original amount, monthly maintenance, court session, past few months, maintenance amount, wife, work place, order, maintenance, address applicant, current pay, child variation, client



Casetype: Custody / Child Access (142 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.04873)
	 - Two children, one is 9 and one is 11.
sentence_2: (dist :0.04873)
	 - Child will be 5 soon.
sentence_3: (dist :0.04573)
	 - Applicant wants custody of the children.
sentence_4: (dist :0.0426)
	 - Applicant would like care and control over the child.
sentence_5: (dist :0.04182)
	 - How should Applicant gain access to the child?
sentence_6: (dist :0.04176)
	 - Applicant and children are Singaporeans.
sentence_7: (dist :0.03763)
	 - After the applicant's divorce with his wife, his wife has been taking care of the children.
sentence_8: (dist :0.03673)
	 - Applicant is a divorcee with a 3 year old child.
sentence_9: (dist :0.03637)
	 - Her children are aged 13 years, 17 years and 18 years.
sentence_10: (dist :0.03603)
	 - Procedure for applying for custody of his children.
sentence_11: (dist :0.03517)
	 - How can I get back my children?
sentence_12: (dist :0.03473)
	 - Applicant is afraid of safety of child.
sentence_13: (dist :0.0343)
	 - Breach of access to the child against ex-husband.
sentence_14: (dist :0.03325)
	 - Children were taken from her house.
sentence_15: (dist :0.0321)
	 - ( 7/3/2017-AM ) Given child access of once weekly.

**keywords:**
custody matters, year old child, access, month old child, child custody, divorce judgment, k2 child, child care, child access, reasonable access, divorce proceeding, child abuse, court order, control, applicant gain, family court, old daughter, youngest child, son, year, applicant, applicant maintenance, wife yesterday, child, wife, daughter, court-ordered access timings, care, been reports, possible variation order, ex husband



Casetype: Magistrate's Complaints & Private Summons (104 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.03238)
	 - Should the applicant lodge another police report?
sentence_2: (dist :0.02775)
	 - Applicant owes $ 20,000.
sentence_3: (dist :0.02762)
	 - Should the applicant file a magistrate's complaint?
sentence_4: (dist :0.02497)
	 - How can the applicant bring the other party to the court?
sentence_5: (dist :0.02353)
	 - The applicant filed for a police report a few days later.
sentence_6: (dist :0.02224)
	 - The applicant has filed a magistrate complaint.
sentence_7: (dist :0.02217)
	 - The applicant lodged a police report against his worker's boyfriend, because his worker's boyfriend threatened him.
sentence_8: (dist :0.02212)
	 - Applicant has his medical reports.
sentence_9: (dist :0.02198)
	 - Applicant visited his house once to deliver the police report.
sentence_10: (dist :0.02008)
	 - Applicant wants to sue him.
sentence_11: (dist :0.02008)
	 - The applicant can also speak Vietnamese.
sentence_12: (dist :0.02005)
	 - Applicant had a girlfriend in 2005.
sentence_13: (dist :0.01987)
	 - Can the applicant claim compensation for injuries etc. via ways other than suing?
sentence_14: (dist :0.01978)
	 - They interviewed the applicant regarding his issue.
sentence_15: (dist :0.01933)
	 - Applicant filed magistrate's complaint with regards to harassment against her for 2 years.
sentence_16: (dist :0.01854)
	 - The applicants were also fined.
sentence_17: (dist :0.01832)
	 - The applicant seeks legal advice as against the Youtuber.
sentence_18: (dist :0.01801)
	 - Applicant enquired as to how he could represent himself in litigation.
sentence_19: (dist :0.01767)
	 - Once harassment began, the Applicant moved to another gallery.
sentence_20: (dist :0.01762)
	 - Applicant wishes to demand for reasonable compensation.
sentence_21: (dist :0.01753)
	 - The applicant was assaulted in school by his classmate.
sentence_22: (dist :0.01741)
	 - The applicant knows the identity of the assailant.
sentence_23: (dist :0.01724)
	 - Every month, applicant was paid back $ 1,500.
sentence_24: (dist :0.01721)
	 - The applicant was recourse against this third party to claim for damages for his injury.
sentence_25: (dist :0.01713)
	 - - Applicant confronted AP after the chemical spray.
sentence_26: (dist :0.0171)
	 - Applicant has documents from the Hospital.
sentence_27: (dist :0.01709)
	 - Applicant has never talked to Adverse Party about these.
sentence_28: (dist :0.017)
	 - The applicant owns a shop, where his worker works.
sentence_29: (dist :0.01668)
	 - Applicant rented a camera to a Adverse Party under a contract.
sentence_30: (dist :0.01665)
	 - The applicant was alone in the pool with the other male.
sentence_31: (dist :0.01655)
	 - Applicant claimed that he was attacked 10 year ago.
sentence_32: (dist :0.01653)
	 - The applicants has already filed skeletal arguments etc.
sentence_33: (dist :0.01632)
	 - The applicant's property has been seized by the police.
sentence_34: (dist :0.01616)
	 - Applicant is being charged under s509 without evidence and was locked up.
sentence_35: (dist :0.01615)
	 - the worker walked away, but the applicant kept walking.
sentence_36: (dist :0.0161)
	 - . Applicant wants to lodge MAG Complaint a Security guard at Condo.
sentence_37: (dist :0.01609)
	 - Applicant was assaulted by members of a secret society.
sentence_38: (dist :0.01603)
	 - Applicant is a complainant, whom which the other party owes him $ 200 after a settlement agreement.
sentence_39: (dist :0.01591)
	 - Applicant clamped the wheel of a man's car.
sentence_40: (dist :0.01561)
	 - The applicant is living alone with her mother.
sentence_41: (dist :0.0156)
	 - The victim is the applicant's sister.
sentence_42: (dist :0.01557)
	 - Applicant claims that Social Services made false claims against him
sentence_43: (dist :0.01547)
	 - Applicant says that the AP then escaped Singapore.
sentence_44: (dist :0.01547)
	 - Applicant was bullied (? ) by his friends.
sentence_45: (dist :0.01547)
	 - Filed police report.
sentence_46: (dist :0.0153)
	 - - Applicant fears that gang members will retaliate should he commence with legal proceedings.
sentence_47: (dist :0.01518)
	 - Applicant lives with a flat partner ( Adverse Party ).
sentence_48: (dist :0.01518)
	 - The applicant refuses a plain apology and wants to claim damages.

**keywords:**
other party, magistrate report, client, applicant prepare, calls, letter boxes, applicant lodge, alleged assault, lawyer, applicant fears, first police report, incident, magistrates, court issue, personal claim, applicant file, police officer, charge, applicant, applicant claim compensation, magistrate complaint, third party, police, grievous injuries, sufficient evidence, case, piece, other people, applicant appeal, satisfactory legal action, car



Casetype: Traffic Violations (103 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.0274)
	 - Applicant was charged for traffic offence.
sentence_2: (dist :0.02587)
	 - Applicant asked the court to concurrently charge all the traffic offences.
sentence_3: (dist :0.02394)
	 - Charged for dangerous driving, car accident.
sentence_4: (dist :0.02322)
	 - How should Applicant proceed with these charges?
sentence_5: (dist :0.02309)
	 - ( 6/3/2017-PM ) Applicant is currently charged with dangerous driving.
sentence_6: (dist :0.02214)
	 - The applicant is being charged 2 cases.
sentence_7: (dist :0.02006)
	 - Charges are driving without a license.
sentence_8: (dist :0.01999)
	 - Applicant wishes to reduce his charge of dangerous driving.
sentence_9: (dist :0.01978)
	 - There are three charges against the Applicant for Drink driving offence.
sentence_10: (dist :0.01977)
	 - Applicant was charged with a hit-and-run accident.
sentence_11: (dist :0.01798)
	 - Applicant was involved in a motor accident and was charged in court.
sentence_12: (dist :0.01797)
	 - He admitted to all six charges.
sentence_13: (dist :0.01781)
	 - Traffic offence.
sentence_14: (dist :0.01769)
	 - Charged with dangerous driving as an uber driver during day time.
sentence_15: (dist :0.01711)
	 - This is the first time A has been charged for a Road Traffic Offence.
sentence_16: (dist :0.01581)
	 - While he served his sentence, he was charged again.
sentence_17: (dist :0.01558)
	 - Client admits to all charges.
sentence_18: (dist :0.01432)
	 - The Applicant subsequently drove his friend to the hospital without a license.
sentence_19: (dist :0.01426)
	 - Applicant's driving license was previously revoked for drunk driving.
sentence_20: (dist :0.01407)
	 - It is likely Road Traffic Act.
sentence_21: (dist :0.01395)
	 - The client drove against the flow of traffic.
sentence_22: (dist :0.01379)
	 - Now, Applicant faces the same charge, and if found guilty, the Applicant would face a mandatory jail sentence.
sentence_23: (dist :0.01341)
	 - On March 2016, at or about 2300 hours, Applicant was involved in a traffic accident at Siglap Road.
sentence_24: (dist :0.01337)
	 - Criminal Revision ( Traffic Offence ).
sentence_25: (dist :0.01317)
	 - Applicant hit a taxi while drink driving ( second offence ).
sentence_26: (dist :0.01306)
	 - The applicant however works as a driver.
sentence_27: (dist :0.01295)
	 - The defendant caused the death of the applicant's sister in a traffic accident.
sentence_28: (dist :0.01295)
	 - Applicant was driving a taxi.

**keywords:**
taxi driver, traffic police, recent charge, traffic light, small surgery applicant, 5th charge, test, dt applicant, valid license, first offence, charge, road traffic act, fine, applicant, second time offender, drive, years, drunk driving, lighter sentence, court date, traffic violations cases, insurance company, demerit points, charge slip, lighter charge, applicant enquires, company vehicle, dangerous driving, criminal-motor accident, client, car



Casetype: Departmental/Statutory Board Charges & Summonses (78 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.02658)
	 - Applicant was charged in Court 26, but it is unclear what exactly, his charges are.
sentence_2: (dist :0.02509)
	 - Charged in Court 23.
sentence_3: (dist :0.0232)
	 - He was charged over $ 90000 for GST.
sentence_4: (dist :0.02307)
	 - 3 charges against the applicant.
sentence_5: (dist :0.02191)
	 - Applicant is of company.
sentence_6: (dist :0.02103)
	 - Applicant is charged, bailed by her father.
sentence_7: (dist :0.02096)
	 - 10 charges was reduced to 8 charges.
sentence_8: (dist :0.02085)
	 - Applicant is not working currently.
sentence_9: (dist :0.02082)
	 - How should the applicant respond to the criminal charges?
sentence_10: (dist :0.01927)
	 - The fine is $ 3000-6000
sentence_11: (dist :0.01891)
	 - He is facing 3 charges in total.
sentence_12: (dist :0.01884)
	 - Whether court fines can be paid in installments?
sentence_13: (dist :0.01854)
	 - This is the applicant's first offence.
sentence_14: (dist :0.01813)
	 - 3rd Jan-attended Court for 3 charges.
sentence_15: (dist :0.01771)
	 - The court date is at 9:30am tomorrow.
sentence_16: (dist :0.01755)
	 - The PP will be proceeding on 4 charges only.
sentence_17: (dist :0.01707)
	 - Applicant is a bankrupt
sentence_18: (dist :0.01705)
	 - The applicant continued to operate her business without a license, resulting in her being charged.
sentence_19: (dist :0.01694)
	 - $ 9,000 charged per false advertisement which was given.
sentence_20: (dist :0.01661)
	 - Applicant is charged for pasting advertisements in several places in Singapore from the years 2010- 2012.
sentence_21: (dist :0.01637)
	 - Applicant has been charged with 30 counts under the EA.
sentence_22: (dist :0.01599)
	 - What are the applicant's possible options.
sentence_23: (dist :0.01591)
	 - The applicant is facing 4 charges for submitting forged academic certificates.
sentence_24: (dist :0.01578)
	 - Applicant had been sentenced for two charges for a fake marriage.
sentence_25: (dist :0.0156)
	 - She is however worried about a fine of $ 3000 to $ 5000.
sentence_26: (dist :0.0152)
	 - Applicant is facing charges from MOM and CPF on outstanding arrears and has court hearings on 16 and 21 March 2017.
sentence_27: (dist :0.01518)
	 - Applicant then received 2 charges more than a year later.
sentence_28: (dist :0.01495)
	 - Court Letter was sent The applicant has five charges currently relating to tampering of the electrical mains.
sentence_29: (dist :0.01489)
	 - Applicant is their only caregiver.
sentence_30: (dist :0.0148)
	 - Applicant was told by LTA to just turn up to court after speaking to them.
sentence_31: (dist :0.01426)
	 - 2 charges for immigration offences.
sentence_32: (dist :0.01424)
	 - - Applicant was issued letters of demand and Form 37.
sentence_33: (dist :0.01377)
	 - The client was a director of a company.
sentence_34: (dist :0.01371)
	 - In 2013, he was hospitalized.
sentence_35: (dist :0.01362)
	 - The applicant was fined for high-rise littering.
sentence_36: (dist :0.01352)
	 - They were served with an order and a fine of $ 1,500 each.
sentence_37: (dist :0.01346)
	 - Charged with offence of spitting.
sentence_38: (dist :0.01342)
	 - The fines are for mosquito breeding.
sentence_39: (dist :0.01332)
	 - ( 7/3/2017-AM ) He is faced with 24 charges. between the period of October 2015 and August 2016,
sentence_40: (dist :0.01332)
	 - What are my rights?
sentence_41: (dist :0.01323)
	 - The first charge sheet stated that the applicant could compound the offence.
sentence_42: (dist :0.01322)
	 - Was the maintenance of the blue bin that of the Applicant?
sentence_43: (dist :0.01305)
	 - MOM has charged 20 times Applicant on 31st October.

**keywords:**
been rumors, high court, singapore company, first charge, half years, mom, trademark act, charges, applicant last, first charge sheet, letter, nea, offence, court fines, times applicant, years old, company, applicant, years, business, court hearing, lower amount, 11th april, work, criminal charges, privaet hire car driver driver, cpf conviction, house, same time, third charge, potential fine



Casetype: Others (61 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.01332)
	 - Applicant incurred a late charge from his bank.
sentence_2: (dist :0.0133)
	 - There are 7 charges here.
sentence_3: (dist :0.01308)
	 - How should A deal with the charge?
sentence_4: (dist :0.01264)
	 - Both Applicant charged under S8(2 ) of Common Gaming House Act.
sentence_5: (dist :0.01251)
	 - The applicant has a criminal charge against her for a conspiracy.
sentence_6: (dist :0.00989)
	 - Applicant faces 42 charges under the Employment Act, proceeding on 15 charges and the rest taken into consideration.
sentence_7: (dist :0.00982)
	 - Legal issues Any claims against the family for shouting at her?
sentence_8: (dist :0.00979)
	 - Applicant had a criminal case a few years ago.
sentence_9: (dist :0.00972)
	 - The client has been charged with dog abandonment.
sentence_10: (dist :0.00962)
	 - They claimed that they were forced to sign on the charge sheet.
sentence_11: (dist :0.00933)
	 - Applicant wants advice regarding his court case.
sentence_12: (dist :0.00918)
	 - The applicant is involved in a case between a government school and an internship company.
sentence_13: (dist :0.00895)
	 - The applicant has not enforced the order for over four years.
sentence_14: (dist :0.00893)
	 - Applicant acted as a middleman.
sentence_15: (dist :0.00829)
	 - Applicant organized a poker session with his friends, and was subsequently contacted by the police and charged.
sentence_16: (dist :0.00803)
	 - The applicant is not eligible for legal aid from the Legal Aid Bureau.
sentence_17: (dist :0.0079)
	 - Applicant's daughter ran away from home.
sentence_18: (dist :0.00788)
	 - Applicant owing about $ 6000.
sentence_19: (dist :0.00786)
	 - The applicant had a hearing at court 14 last month.
sentence_20: (dist :0.00777)
	 - Charged with possession of weapon in public.
sentence_21: (dist :0.00764)
	 - Can the client's son be charged for having sexual relationship?
sentence_22: (dist :0.00729)
	 - ( This is for the baby bonus money ) Applicant's wife is a non-Singaporean and ca n't be the trustee
sentence_23: (dist :0.00724)
	 - Adverse Party's son has admitted to charges.
sentence_24: (dist :0.00721)
	 - Is there issues of time bar?
sentence_25: (dist :0.00714)
	 - There's a difference between admitting to facts, and admitting to charges.
sentence_26: (dist :0.00702)
	 - Charged under s 182 of the Penal Code ( giving public servant false information ).
sentence_27: (dist :0.00656)
	 - need to attend court. gambling offence. charged for hosting gambling but was actually playing. ask whether he should get a lawyer.
sentence_28: (dist :0.00649)
	 - The applicant has a court trial pending.
sentence_29: (dist :0.00627)
	 - Applicant owns a cat cafe.

**keywords:**
criminal charge, baby bonus money, friend, singapore, false information, agc applicant, eviction order, government school, normal charges, dog abandonment, legal aid bureau, charge, few years, son, property, company, court case, home ownership, applicant, prc lawyer, claim, ava, harassment act, late charges, family development, child, police, order, personal protection order, client, time bar



Casetype: Tenancy Disputes (53 cases)

Columns used: advice and synopsis
**excerpts:**
sentence_1: (dist :0.03626)
	 - Applicant took the matter to court and the tenant was ordered by the court to pay arrears.
sentence_2: (dist :0.03473)
	 - Applicant is the tenant.
sentence_3: (dist :0.03425)
	 - Applicant is the landlord that rented his property to the tenant.
sentence_4: (dist :0.03337)
	 - Rental issue: Applicant is tenant.
sentence_5: (dist :0.02797)
	 - The tenancy agreement is expiring in 1 month.
sentence_6: (dist :0.02737)
	 - Landlord and Tenant Dispute.
sentence_7: (dist :0.0273)
	 - As of now, the tenant can not be reached.
sentence_8: (dist :0.02723)
	 - Applicant is a subtenant who rented a unit from a tenant.
sentence_9: (dist :0.02556)
	 - The deposit was 1 months' worth of the rent, amounting to about $ 1,500.
sentence_10: (dist :0.02432)
	 - The landlord turned off the wifi whilst the tenant was still using the wifi.
sentence_11: (dist :0.02431)
	 - The tenancy is actually a sub-letting agreement.
sentence_12: (dist :0.02374)
	 - Applicant's parents are the landlord.
sentence_13: (dist :0.0225)
	 - but the rental was settled late based on the tenancy agreement.
sentence_14: (dist :0.02232)
	 - Applicants are a couple and are facing a landlord tenancy dispute.
sentence_15: (dist :0.0223)
	 - The applicant is involved in a tenancy dispute.
sentence_16: (dist :0.02193)
	 - Breach of contract between tenant and landlord.
sentence_17: (dist :0.02168)
	 - This condominium is shared with 6 other tenants.
sentence_18: (dist :0.02139)
	 - Tenant has been verbally abusive to other tenants.
sentence_19: (dist :0.02139)
	 - Tenant 1: Applicant has a tenant.
sentence_20: (dist :0.0207)
	 - The landlord holds a 2 month deposit.
sentence_21: (dist :0.02014)
	 - Initially, applicant filed a claim against the landlord and was successful in claiming for damages.
sentence_22: (dist :0.01994)
	 - Only verbal agreement between tenant and landlord, did not know landlord beforehand.
sentence_23: (dist :0.01935)
	 - Lease is already over.
sentence_24: (dist :0.01923)
	 - Landlord is demanding $ 2,800 in total for rent and damages.
sentence_25: (dist :0.01898)
	 - How does applicant evict the tenant?
sentence_26: (dist :0.01885)
	 - Applicant rented his house out.
sentence_27: (dist :0.01884)
	 - Letter of intent was signed by 1 out of 2 landlords and the applicant.
sentence_28: (dist :0.01881)
	 - Tenant breached tenancy agreement- to default rental for more than 7 days.

**keywords:**
goodwill deposit, landlord tenancy dispute, landlord, former tenants, tenant dispute, year lease, residential property, rent, months rent, apartment, previous landlord, half month, other tenants, applicant claim, deposit lease agreement, tenant, applicant, small claims, rental deposit applicant, real landlord, property guru, tenancy agreement, first agent, february rent, new room, additional damages, few months, house, rental house, been court orders, contract